Merge pull request #118270 from pacoxu/warningonly-for-deprecatedFG

kubeadm: warning only for deprecated FG
This commit is contained in:
Kubernetes Prow Robot 2023-05-29 08:23:55 -07:00 committed by GitHub
commit 76bad75c1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -205,7 +205,6 @@ func enforceRequirements(flags *applyPlanFlags, args []string, dryRun bool, upgr
for _, m := range msg {
printer.Printf("[upgrade/config] %s\n", m)
}
return nil, nil, nil, errors.New("[upgrade/config] FATAL. Unable to upgrade a cluster using deprecated feature-gate flags. Please see the release notes")
}
// If the user told us to print this information out; do it!

View File

@ -26,6 +26,7 @@ import (
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/component-base/featuregate"
"k8s.io/klog/v2"
)
const (
@ -90,9 +91,9 @@ func Enabled(featureList map[string]bool, featureName string) bool {
// Supports indicates whether a feature name is supported on the given
// feature set
func Supports(featureList FeatureList, featureName string) bool {
for k, v := range featureList {
for k := range featureList {
if featureName == k {
return v.PreRelease != featuregate.Deprecated
return true
}
}
return false
@ -148,7 +149,7 @@ func NewFeatureGate(f *FeatureList, value string) (map[string]bool, error) {
}
if featureSpec.PreRelease == featuregate.Deprecated {
return nil, errors.Errorf("feature-gate key is deprecated: %s", k)
klog.Warningf("Setting deprecated feature gate %s=%t. It will be removed in a future release.", k, v)
}
boolValue, err := strconv.ParseBool(v)

View File

@ -93,7 +93,8 @@ func TestNewFeatureGate(t *testing.T) {
},
{ //deprecated feature-gate key
value: "deprecated=true",
expectedError: true,
expectedError: false,
expectedFeaturesGate: map[string]bool{"deprecated": true},
},
{ //one feature
value: "feature1=true",