kubeadm: warning only for deprecated FG

This commit is contained in:
Paco Xu 2023-05-26 09:40:57 +08:00
parent d8e9a7b33a
commit 6a867eacd8
2 changed files with 5 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import (
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/component-base/featuregate"
"k8s.io/klog/v2"
)
const (
@ -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

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