From 62447b9e7d97f2c2b8f4c4c50567f913196812e5 Mon Sep 17 00:00:00 2001 From: Dan Jones <108552543+danj-replicated@users.noreply.github.com> Date: Mon, 11 Dec 2023 19:39:31 +0000 Subject: [PATCH] Enable dynamic config (#215) --- cmd/embedded-cluster/join.go | 2 +- pkg/config/config.go | 5 +++-- pkg/config/host.go | 2 +- pkg/config/testdata/override-change-name.yaml | 4 ++-- pkg/config/testdata/override-enable-telemetry.yaml | 4 ++-- pkg/config/testdata/override-setting-ip-forward.yaml | 4 ++-- pkg/config/testdata/override-zero-out-sans-list.yaml | 4 ++-- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/cmd/embedded-cluster/join.go b/cmd/embedded-cluster/join.go index 3ccb57b6f..834af1660 100644 --- a/cmd/embedded-cluster/join.go +++ b/cmd/embedded-cluster/join.go @@ -223,7 +223,7 @@ func runK0sInstallCommand(fullcmd string) error { args := strings.Split(fullcmd, " ") args = append(args, "--token-file", "/etc/k0s/join-token") if strings.Contains(fullcmd, "controller") { - args = append(args, "--disable-components", "konnectivity-server") + args = append(args, "--disable-components", "konnectivity-server", "--enable-dynamic-config") } cmd := exec.Command(args[0], args[1:]...) stdout := bytes.NewBuffer(nil) diff --git a/pkg/config/config.go b/pkg/config/config.go index 38e7597b8..d0c22b6a8 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -232,8 +232,9 @@ func generateConfigForHosts(ctx context.Context, hosts ...*cluster.Host) (*v1bet Spec: &cluster.Spec{ Hosts: hosts, K0s: &cluster.K0s{ - Version: k0sversion.MustParse(defaults.K0sVersion), - Config: k0sconfig, + DynamicConfig: true, + Version: k0sversion.MustParse(defaults.K0sVersion), + Config: k0sconfig, }, }, }, nil diff --git a/pkg/config/host.go b/pkg/config/host.go index 08d9d9ad4..d9f68039a 100644 --- a/pkg/config/host.go +++ b/pkg/config/host.go @@ -27,7 +27,7 @@ type hostcfg struct { func (h *hostcfg) render() *cluster.Host { var ifls []string if h.Role != "worker" { - ifls = []string{"--disable-components konnectivity-server"} + ifls = []string{"--disable-components konnectivity-server --enable-dynamic-config"} } ifls = append(ifls, labelsToArg(h.Labels)...) return &cluster.Host{ diff --git a/pkg/config/testdata/override-change-name.yaml b/pkg/config/testdata/override-change-name.yaml index 6d1c7df70..431bea01e 100644 --- a/pkg/config/testdata/override-change-name.yaml +++ b/pkg/config/testdata/override-change-name.yaml @@ -16,7 +16,7 @@ config: |- noTaints: true k0s: version: v1.27.5+k0s.0 - dynamicConfig: false + dynamicConfig: true config: apiVersion: k0s.k0sproject.io/v1beta1 kind: ClusterConfig @@ -53,7 +53,7 @@ expected: |- noTaints: true k0s: version: v1.27.5+k0s.0 - dynamicConfig: false + dynamicConfig: true config: apiVersion: k0s.k0sproject.io/v1beta1 kind: ClusterConfig diff --git a/pkg/config/testdata/override-enable-telemetry.yaml b/pkg/config/testdata/override-enable-telemetry.yaml index 853496273..091aa52d1 100644 --- a/pkg/config/testdata/override-enable-telemetry.yaml +++ b/pkg/config/testdata/override-enable-telemetry.yaml @@ -16,7 +16,7 @@ config: |- noTaints: true k0s: version: v1.27.5+k0s.0 - dynamicConfig: false + dynamicConfig: true config: apiVersion: k0s.k0sproject.io/v1beta1 kind: ClusterConfig @@ -54,7 +54,7 @@ expected: |- noTaints: true k0s: version: v1.27.5+k0s.0 - dynamicConfig: false + dynamicConfig: true config: apiVersion: k0s.k0sproject.io/v1beta1 kind: ClusterConfig diff --git a/pkg/config/testdata/override-setting-ip-forward.yaml b/pkg/config/testdata/override-setting-ip-forward.yaml index 94da52599..c66e046e8 100644 --- a/pkg/config/testdata/override-setting-ip-forward.yaml +++ b/pkg/config/testdata/override-setting-ip-forward.yaml @@ -16,7 +16,7 @@ config: |- noTaints: true k0s: version: v1.27.5+k0s.0 - dynamicConfig: false + dynamicConfig: true config: apiVersion: k0s.k0sproject.io/v1beta1 kind: ClusterConfig @@ -57,7 +57,7 @@ expected: |- noTaints: true k0s: version: v1.27.5+k0s.0 - dynamicConfig: false + dynamicConfig: true config: apiVersion: k0s.k0sproject.io/v1beta1 kind: ClusterConfig diff --git a/pkg/config/testdata/override-zero-out-sans-list.yaml b/pkg/config/testdata/override-zero-out-sans-list.yaml index 742f0f581..e502c68d3 100644 --- a/pkg/config/testdata/override-zero-out-sans-list.yaml +++ b/pkg/config/testdata/override-zero-out-sans-list.yaml @@ -16,7 +16,7 @@ config: |- noTaints: true k0s: version: v1.27.5+k0s.0 - dynamicConfig: false + dynamicConfig: true config: apiVersion: k0s.k0sproject.io/v1beta1 kind: ClusterConfig @@ -58,7 +58,7 @@ expected: |- noTaints: true k0s: version: v1.27.5+k0s.0 - dynamicConfig: false + dynamicConfig: true config: apiVersion: k0s.k0sproject.io/v1beta1 kind: ClusterConfig