Skip to content

Commit 071296a

Browse files
authored
Merge pull request kubernetes#129643 from dims/prevent-alpha-feature-gates-from-being-enabled-by-default
Prevent alpha feature gates from being enabled by default
2 parents 6d570c9 + 226b43b commit 071296a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pkg/features/kube_features_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,27 @@ func TestAllRegisteredFeaturesExpected(t *testing.T) {
7373
}
7474
}
7575
}
76+
func TestEnsureAlphaGatesAreNotSwitchedOnByDefault(t *testing.T) {
77+
checkAlphaGates := func(feature featuregate.Feature, spec featuregate.FeatureSpec) {
78+
// FIXME(dims): remove this check when WindowsHostNetwork is fixed up or removed
79+
// entirely. Please do NOT add more entries here.
80+
if feature == "WindowsHostNetwork" {
81+
return
82+
}
83+
if spec.PreRelease == featuregate.Alpha && spec.Default {
84+
t.Errorf("The alpha feature gate %q is switched on by default", feature)
85+
}
86+
if spec.PreRelease == featuregate.Alpha && spec.LockToDefault {
87+
t.Errorf("The alpha feature gate %q is locked to default", feature)
88+
}
89+
}
90+
91+
for feature, spec := range defaultKubernetesFeatureGates {
92+
checkAlphaGates(feature, spec)
93+
}
94+
for feature, specs := range defaultVersionedKubernetesFeatureGates {
95+
for _, spec := range specs {
96+
checkAlphaGates(feature, spec)
97+
}
98+
}
99+
}

0 commit comments

Comments
 (0)