diff --git a/pkg/genericclioptions/feature_gates.go b/pkg/genericclioptions/feature_gates.go index 2c516c8a..26e51dec 100644 --- a/pkg/genericclioptions/feature_gates.go +++ b/pkg/genericclioptions/feature_gates.go @@ -20,7 +20,6 @@ func init() { // Update default features utilruntime.Must(HubMutableFeatureGate.SetFromMap(map[string]bool{string(ocmfeature.DefaultClusterSet): true})) - utilruntime.Must(SpokeMutableFeatureGate.SetFromMap(map[string]bool{string(ocmfeature.AddonManagement): true})) } func ConvertToFeatureGateAPI(featureGates featuregate.MutableFeatureGate, defaultFeatureGate map[featuregate.Feature]featuregate.FeatureSpec) []operatorv1.FeatureGate { @@ -34,6 +33,9 @@ func ConvertToFeatureGateAPI(featureGates featuregate.MutableFeatureGate, defaul } if featureGates.Enabled(feature) { features = append(features, operatorv1.FeatureGate{Feature: string(feature), Mode: operatorv1.FeatureGateModeTypeEnable}) + } else if defaultFeatureGate[feature].Default { + // Explicitly disable the feature gate that is enabled by default + features = append(features, operatorv1.FeatureGate{Feature: string(feature), Mode: operatorv1.FeatureGateModeTypeDisable}) } } diff --git a/pkg/genericclioptions/feature_gates_test.go b/pkg/genericclioptions/feature_gates_test.go index e3bafdb2..662096f2 100644 --- a/pkg/genericclioptions/feature_gates_test.go +++ b/pkg/genericclioptions/feature_gates_test.go @@ -27,7 +27,9 @@ func TestConvertToFeatureGateAPI(t *testing.T) { return fg }, defaultFeatureGate: ocmfeature.DefaultHubAddonManagerFeatureGates, - expected: []operatorv1.FeatureGate{}, + expected: []operatorv1.FeatureGate{ + {Feature: "AddonManagement", Mode: operatorv1.FeatureGateModeTypeDisable}, + }, }, { name: "enable default feature gate",