From 533bee2b12902ce1ed5d6b98c897a48f0256e083 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 29 Feb 2024 08:58:35 -0600 Subject: [PATCH 1/7] use wip ec-operator --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 47d989205..94f0027e9 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/gosimple/slug v1.14.0 github.com/jedib0t/go-pretty v4.3.0+incompatible github.com/k0sproject/dig v0.2.0 - github.com/replicatedhq/embedded-cluster-operator v0.24.1 + github.com/replicatedhq/embedded-cluster-operator v0.24.2-0.20240227201310-c946021e227e github.com/replicatedhq/embedded-cluster-utils v0.0.0-20240214185439-68a1dfae58be github.com/replicatedhq/kotskinds v0.0.0-20230724164735-f83482cc9cfe github.com/replicatedhq/troubleshoot v0.83.0 @@ -40,7 +40,7 @@ require ( github.com/google/pprof v0.0.0-20230323073829-e72429f035bd // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect - github.com/ohler55/ojg v1.21.2 // indirect + github.com/ohler55/ojg v1.21.3 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect diff --git a/go.sum b/go.sum index 80f73e390..340bb51f2 100644 --- a/go.sum +++ b/go.sum @@ -210,6 +210,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/ohler55/ojg v1.21.2 h1:6N3eBqzMQ4lYurweV/H/c3DK0Z2ufj8aZcAj3mhknwM= github.com/ohler55/ojg v1.21.2/go.mod h1:gQhDVpQLqrmnd2eqGAvJtn+NfKoYJbe/A4Sj3/Vro4o= +github.com/ohler55/ojg v1.21.3 h1:0smW0EKpyPBBIpTKhM+UbCDeQFbR0oEUxym+rFv2Y/8= +github.com/ohler55/ojg v1.21.3/go.mod h1:gQhDVpQLqrmnd2eqGAvJtn+NfKoYJbe/A4Sj3/Vro4o= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= @@ -241,6 +243,8 @@ github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/replicatedhq/embedded-cluster-operator v0.24.1 h1:1eBhFJVz9eQvGx5DywQeQOIS9MBj2lJqBgEcqQtEAF4= github.com/replicatedhq/embedded-cluster-operator v0.24.1/go.mod h1:CFiwfofNfU2lwUVC0hA6XTodmM40hYJwXgdMza1AT2w= +github.com/replicatedhq/embedded-cluster-operator v0.24.2-0.20240227201310-c946021e227e h1:EiBb3X8sWkVO4aL4CcDoCDouUcEPJPMwnZ9CZOd132w= +github.com/replicatedhq/embedded-cluster-operator v0.24.2-0.20240227201310-c946021e227e/go.mod h1:gKLyq+Ap1d1uzt/xN1sYvs19bwf6XT4L04C1yRgcaXA= github.com/replicatedhq/embedded-cluster-utils v0.0.0-20240214185439-68a1dfae58be h1:wuHmBUANuvCUeX4WmUVf7AWOlRTJMAmAR/GsYOY0Jdo= github.com/replicatedhq/embedded-cluster-utils v0.0.0-20240214185439-68a1dfae58be/go.mod h1:4JmMC2CwMCLxq05GEW3XSPPVotqyamAF/omrbB3pH+c= github.com/replicatedhq/kotskinds v0.0.0-20230724164735-f83482cc9cfe h1:3AJInd06UxzqHmgy8+24CPsT2tYSE0zToJZyuX9q+MA= From 2fd5119d471fa0ee3544ebe5c712c8179496793e Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 29 Feb 2024 09:41:40 -0600 Subject: [PATCH 2/7] apply on initial install --- cmd/embedded-cluster/install.go | 1 + pkg/config/config.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/cmd/embedded-cluster/install.go b/cmd/embedded-cluster/install.go index 562879132..5a91e1ba6 100644 --- a/cmd/embedded-cluster/install.go +++ b/cmd/embedded-cluster/install.go @@ -217,6 +217,7 @@ func applyUnsupportedOverrides(c *cli.Context, cfg *k0sconfig.ClusterConfig) (*k if cfg, err = config.PatchK0sConfig(cfg, overrides); err != nil { return nil, fmt.Errorf("unable to patch k0s config: %w", err) } + cfg.Spec.WorkerProfiles = embcfg.Spec.WorkerProfiles } if c.String("overrides") == "" { return cfg, nil diff --git a/pkg/config/config.go b/pkg/config/config.go index 88912de9d..ae3d3c3c5 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -134,12 +134,14 @@ func PatchK0sConfig(config *k0sconfig.ClusterConfig, patch string) (*k0sconfig.C } // InstallFlags returns a list of default flags to be used when bootstrapping a k0s cluster. +// https://docs.k0sproject.io/v1.29.2+k0s.0/cli/k0s_install_controller/ func InstallFlags() []string { return []string{ "install", "controller", "--disable-components", "konnectivity-server", "--labels", strings.Join(nodeLabels(), ","), + "--profile", strings.Join(workerProfiles(), ","), "--enable-worker", "--no-taints", "--enable-dynamic-config", @@ -173,6 +175,18 @@ func getControllerRoleName() string { return controllerRoleName } +func workerProfiles() []string { + clusterConfig, err := release.GetEmbeddedClusterConfig() + if err == nil { + if clusterConfig != nil { + if clusterConfig.Spec.Roles.Controller.WorkerProfiles != nil { + return clusterConfig.Spec.Roles.Controller.WorkerProfiles + } + } + } + return []string{"default"} +} + func additionalControllerLabels() map[string]string { clusterConfig, err := release.GetEmbeddedClusterConfig() if err == nil { From d50e4e8dcdeccf9f20671f80f79e0df7a3af3c59 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 29 Feb 2024 10:04:54 -0600 Subject: [PATCH 3/7] add worker profile to unit test --- e2e/kots-release-install/cluster-config.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/e2e/kots-release-install/cluster-config.yaml b/e2e/kots-release-install/cluster-config.yaml index adcc616a1..be76a8157 100644 --- a/e2e/kots-release-install/cluster-config.yaml +++ b/e2e/kots-release-install/cluster-config.yaml @@ -9,6 +9,9 @@ spec: labels: controller-label: controller-label-value name: controller-test + workerProfiles: + - controller-profile + - custom-eviction custom: - labels: abc-test-label: abc-test-label-value @@ -28,6 +31,21 @@ spec: api: extraArgs: service-node-port-range: 80-32767 + workerProfiles: + - name: controller-profile + values: + allowedUnsafeSysctls: + - fs.inotify.max_user_instances + - name: custom-eviction + values: + evictionHard: + memory.available: "500Mi" + nodefs.available: "1Gi" + imagefs.available: "100Gi" + evictionMinimumReclaim: + memory.available: "0Mi" + nodefs.available: "500Mi" + imagefs.available: "2Gi" extensions: helm: repositories: From fe6ed48449ffd4226e29696ecee26b6ef98d6ad6 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 29 Feb 2024 10:19:23 -0600 Subject: [PATCH 4/7] one profile --- e2e/kots-release-install/cluster-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/kots-release-install/cluster-config.yaml b/e2e/kots-release-install/cluster-config.yaml index be76a8157..5ba8b579b 100644 --- a/e2e/kots-release-install/cluster-config.yaml +++ b/e2e/kots-release-install/cluster-config.yaml @@ -11,7 +11,7 @@ spec: name: controller-test workerProfiles: - controller-profile - - custom-eviction +# - custom-eviction custom: - labels: abc-test-label: abc-test-label-value From a815a0c668844241a9982c2bd1bbdbdb6d0b074b Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 29 Feb 2024 11:31:46 -0600 Subject: [PATCH 5/7] logs --- e2e/scripts/single-node-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/e2e/scripts/single-node-install.sh b/e2e/scripts/single-node-install.sh index 818600ff8..2301aec40 100644 --- a/e2e/scripts/single-node-install.sh +++ b/e2e/scripts/single-node-install.sh @@ -213,6 +213,8 @@ main() { if ! embedded-cluster install --no-prompt --license /tmp/license.yaml 2>&1 | tee /tmp/log ; then echo "Failed to install embedded-cluster" + systemctl status k0scontroller.service + journalctl -u k0scontroller exit 1 fi if ! grep -q "Admin Console is ready!" /tmp/log; then From 6ffb9776648851dde946451661f69af8697818c3 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 29 Feb 2024 11:47:10 -0600 Subject: [PATCH 6/7] f --- e2e/kots-release-install/cluster-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/kots-release-install/cluster-config.yaml b/e2e/kots-release-install/cluster-config.yaml index 5ba8b579b..699500f65 100644 --- a/e2e/kots-release-install/cluster-config.yaml +++ b/e2e/kots-release-install/cluster-config.yaml @@ -10,8 +10,8 @@ spec: controller-label: controller-label-value name: controller-test workerProfiles: - - controller-profile -# - custom-eviction +# - controller-profile + - custom-eviction custom: - labels: abc-test-label: abc-test-label-value From 56ab78f93c7324f1d04496ff7ee5d6d91c19c93b Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 29 Feb 2024 15:25:04 -0600 Subject: [PATCH 7/7] add default profile --- e2e/kots-release-install/cluster-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/kots-release-install/cluster-config.yaml b/e2e/kots-release-install/cluster-config.yaml index 699500f65..f453e9e16 100644 --- a/e2e/kots-release-install/cluster-config.yaml +++ b/e2e/kots-release-install/cluster-config.yaml @@ -10,7 +10,7 @@ spec: controller-label: controller-label-value name: controller-test workerProfiles: -# - controller-profile + - default - custom-eviction custom: - labels: