Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide worker profiles to join command #425

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/embedded-cluster/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions e2e/kots-release-install/cluster-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ spec:
labels:
controller-label: controller-label-value
name: controller-test
workerProfiles:
- default
- custom-eviction
custom:
- labels:
abc-test-label: abc-test-label-value
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions e2e/scripts/single-node-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
14 changes: 14 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 {
Expand Down
Loading