From a2a33005121e2fd9bf5a7d6df80cfb5a884dcc49 Mon Sep 17 00:00:00 2001 From: Saurabh Parekh Date: Thu, 21 Mar 2024 18:10:27 -0700 Subject: [PATCH] Add api server extra args feature flag to eksa controller deployment --- pkg/clustermanager/eksa_installer.go | 5 +++++ pkg/clustermanager/eksa_installer_test.go | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/pkg/clustermanager/eksa_installer.go b/pkg/clustermanager/eksa_installer.go index 86193c334419..6e7b27fe2cc7 100644 --- a/pkg/clustermanager/eksa_installer.go +++ b/pkg/clustermanager/eksa_installer.go @@ -247,6 +247,11 @@ func setManagerEnvVars(d *appsv1.Deployment, spec *cluster.Spec) { envVars = append(envVars, v1.EnvVar{Name: features.VSphereInPlaceEnvVar, Value: "true"}) } + // TODO: remove this feature flag when we support API server flags. + if features.IsActive(features.APIServerExtraArgsEnabled()) { + envVars = append(envVars, v1.EnvVar{Name: features.APIServerExtraArgsEnabledEnvVar, Value: "true"}) + } + d.Spec.Template.Spec.Containers[0].Env = envVars } diff --git a/pkg/clustermanager/eksa_installer_test.go b/pkg/clustermanager/eksa_installer_test.go index 16875979f4ab..3d17b1738367 100644 --- a/pkg/clustermanager/eksa_installer_test.go +++ b/pkg/clustermanager/eksa_installer_test.go @@ -420,6 +420,26 @@ func TestSetManagerEnvVarsVSphereInPlaceUpgrade(t *testing.T) { g.Expect(deploy).To(Equal(want)) } +func TestSetManagerEnvVarsAPIServerExtraArgs(t *testing.T) { + g := NewWithT(t) + features.ClearCache() + t.Setenv(features.APIServerExtraArgsEnabledEnvVar, "true") + + deploy := deployment() + spec := test.NewClusterSpec() + want := deployment(func(d *appsv1.Deployment) { + d.Spec.Template.Spec.Containers[0].Env = []corev1.EnvVar{ + { + Name: "API_SERVER_EXTRA_ARGS_ENABLED", + Value: "true", + }, + } + }) + + clustermanager.SetManagerEnvVars(deploy, spec) + g.Expect(deploy).To(Equal(want)) +} + func TestEKSAInstallerNewUpgraderConfigMap(t *testing.T) { tt := newInstallerTest(t)