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

🐛 Explicitly disable the feature gate that is enabled by default #456

Merged
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
4 changes: 3 additions & 1 deletion pkg/genericclioptions/feature_gates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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})
}
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/genericclioptions/feature_gates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading