diff --git a/pkg/features/features.go b/pkg/features/features.go index 479ad7cf8b8f..dd0c7f9b6844 100644 --- a/pkg/features/features.go +++ b/pkg/features/features.go @@ -5,6 +5,7 @@ const ( CloudStackKubeVipDisabledEnvVar = "CLOUDSTACK_KUBE_VIP_DISABLED" CheckpointEnabledEnvVar = "CHECKPOINT_ENABLED" UseNewWorkflowsEnvVar = "USE_NEW_WORKFLOWS" + UseControllerForCli = "USE_CONTROLLER_FOR_CLI" ) func FeedGates(featureGates []string) { @@ -45,3 +46,11 @@ func UseNewWorkflows() Feature { IsActive: globalFeatures.isActiveForEnvVar(UseNewWorkflowsEnvVar), } } + +// UseControllerViaCLIWorkflow is used for the controller behind the CLI workflow. +func UseControllerViaCLIWorkflow() Feature { + return Feature{ + Name: "Use new workflow logic for cluster operations leveraging controller via CLI", + IsActive: globalFeatures.isActiveForEnvVar(UseControllerForCli), + } +} diff --git a/pkg/features/features_test.go b/pkg/features/features_test.go index 6229980d8050..be9e8d8f421f 100644 --- a/pkg/features/features_test.go +++ b/pkg/features/features_test.go @@ -69,3 +69,19 @@ func TestIsActiveWithFeatureGatesTrue(t *testing.T) { g.Expect(IsActive(fakeFeatureWithGate())).To(BeTrue()) } + +func TestUseControllerForCliFalse(t *testing.T) { + g := NewWithT(t) + setupContext(t) + + t.Setenv(UseControllerForCli, "false") + g.Expect(UseControllerViaCLIWorkflow().IsActive()).To(BeFalse()) +} + +func TestUseControllerForCliTrue(t *testing.T) { + g := NewWithT(t) + setupContext(t) + + t.Setenv(UseControllerForCli, "true") + g.Expect(UseControllerViaCLIWorkflow().IsActive()).To(BeTrue()) +}