mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 22:05:59 +00:00
Merge pull request #118270 from pacoxu/warningonly-for-deprecatedFG
kubeadm: warning only for deprecated FG
This commit is contained in:
commit
76bad75c1e
@ -205,7 +205,6 @@ func enforceRequirements(flags *applyPlanFlags, args []string, dryRun bool, upgr
|
|||||||
for _, m := range msg {
|
for _, m := range msg {
|
||||||
printer.Printf("[upgrade/config] %s\n", m)
|
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!
|
// If the user told us to print this information out; do it!
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/version"
|
"k8s.io/apimachinery/pkg/util/version"
|
||||||
"k8s.io/component-base/featuregate"
|
"k8s.io/component-base/featuregate"
|
||||||
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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
|
// Supports indicates whether a feature name is supported on the given
|
||||||
// feature set
|
// feature set
|
||||||
func Supports(featureList FeatureList, featureName string) bool {
|
func Supports(featureList FeatureList, featureName string) bool {
|
||||||
for k, v := range featureList {
|
for k := range featureList {
|
||||||
if featureName == k {
|
if featureName == k {
|
||||||
return v.PreRelease != featuregate.Deprecated
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -148,7 +149,7 @@ func NewFeatureGate(f *FeatureList, value string) (map[string]bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if featureSpec.PreRelease == featuregate.Deprecated {
|
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)
|
boolValue, err := strconv.ParseBool(v)
|
||||||
|
@ -92,8 +92,9 @@ func TestNewFeatureGate(t *testing.T) {
|
|||||||
expectedError: true,
|
expectedError: true,
|
||||||
},
|
},
|
||||||
{ //deprecated feature-gate key
|
{ //deprecated feature-gate key
|
||||||
value: "deprecated=true",
|
value: "deprecated=true",
|
||||||
expectedError: true,
|
expectedError: false,
|
||||||
|
expectedFeaturesGate: map[string]bool{"deprecated": true},
|
||||||
},
|
},
|
||||||
{ //one feature
|
{ //one feature
|
||||||
value: "feature1=true",
|
value: "feature1=true",
|
||||||
|
Loading…
Reference in New Issue
Block a user