diff --git a/go.mod b/go.mod index 4dde9a3..53b5eb7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/jnsgruk/concierge -go 1.22.7 +go 1.23 require ( github.com/canonical/x-go v0.0.0-20230522092633-7947a7587f5b diff --git a/internal/providers/k8s.go b/internal/providers/k8s.go index 2296d70..0494196 100644 --- a/internal/providers/k8s.go +++ b/internal/providers/k8s.go @@ -3,7 +3,9 @@ package providers import ( "fmt" "log/slog" + "maps" "path" + "slices" "strings" "time" @@ -158,7 +160,17 @@ func (k *K8s) init() error { // configureFeatures iterates over the specified features, enabling and configuring them. func (k *K8s) configureFeatures() error { - for featureName, conf := range k.Features { + // Ensure the network feature is always enabled firsti if specified, as others depend on it. + keys := slices.Sorted(maps.Keys(k.Features)) + // If the network feature is specified, ensure it's at the front of the list of features + // that we iterate over so it's enabled first + if slices.Contains(keys, "network") { + remaining := slices.DeleteFunc(keys, func(v string) bool { return v == "network" }) + keys = slices.Insert(remaining, 0, "network") + } + + for _, featureName := range keys { + conf := k.Features[featureName] for key, value := range conf { featureConfig := fmt.Sprintf("%s.%s=%s", featureName, key, value)