mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Merge pull request #125797 from SataQiu/fix-upgrade-20240629
kubeadm: the '--feature-gates' flag is deprecated and no-op for 'kubeadm upgrade apply/plan'
This commit is contained in:
commit
d902351c99
@ -609,7 +609,9 @@ func isAllowedFlag(flagName string) bool {
|
||||
kubeadmcmdoptions.NodeName,
|
||||
kubeadmcmdoptions.KubeconfigDir,
|
||||
kubeadmcmdoptions.UploadCerts,
|
||||
kubeadmcmdoptions.FeatureGatesString, // TODO: remove this line when --feature-gates flag is deprecated and dropped from "kubeadm upgrade apply/plan"
|
||||
"api-server-manifest", "controller-manager-manifest", "scheduler-manifest", // TODO: remove this line when these flags are deprecated and dropped from "kubeadm upgrade diff"
|
||||
"allow-missing-template-keys", "output", "show-managed-fields",
|
||||
"print-join-command", "rootfs", "v", "log-file", "yes")
|
||||
if allowedFlags.Has(flagName) {
|
||||
return true
|
||||
|
@ -143,14 +143,6 @@ func enforceRequirements(flagSet *pflag.FlagSet, flags *applyPlanFlags, args []s
|
||||
return nil, nil, nil, nil, errors.Wrap(err, "[upgrade/health] FATAL")
|
||||
}
|
||||
|
||||
// If features gates are passed to the command line, use it (otherwise use featureGates from configuration)
|
||||
if flags.featureGatesString != "" {
|
||||
initCfg.FeatureGates, err = features.NewFeatureGate(&features.InitFeatureGates, flags.featureGatesString)
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, errors.Wrap(err, "[upgrade/config] FATAL")
|
||||
}
|
||||
}
|
||||
|
||||
// Check if feature gate flags used in the cluster are consistent with the set of features currently supported by kubeadm
|
||||
if msg := features.CheckDeprecatedFlags(&features.InitFeatureGates, initCfg.FeatureGates); len(msg) > 0 {
|
||||
for _, m := range msg {
|
||||
|
@ -17,11 +17,13 @@ limitations under the License.
|
||||
package upgrade
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||
@ -71,6 +73,8 @@ func addApplyPlanFlags(fs *pflag.FlagSet, flags *applyPlanFlags) {
|
||||
fs.BoolVar(&flags.allowExperimentalUpgrades, "allow-experimental-upgrades", flags.allowExperimentalUpgrades, "Show unstable versions of Kubernetes as an upgrade alternative and allow upgrading to an alpha/beta/release candidate versions of Kubernetes.")
|
||||
fs.BoolVar(&flags.allowRCUpgrades, "allow-release-candidate-upgrades", flags.allowRCUpgrades, "Show release candidate versions of Kubernetes as an upgrade alternative and allow upgrading to a release candidate versions of Kubernetes.")
|
||||
fs.BoolVar(&flags.printConfig, "print-config", flags.printConfig, "Specifies whether the configuration file that will be used in the upgrade should be printed or not.")
|
||||
options.AddFeatureGatesStringFlag(fs, &flags.featureGatesString)
|
||||
options.AddFeatureGatesStringFlag(fs, &flags.featureGatesString) // TODO: remove in 1.32
|
||||
_ = fs.MarkDeprecated(options.FeatureGatesString, fmt.Sprintf("This flag is deprecated and no-op now. It will be removed in a future release. The upgrade workflow is not designed to reconfigure the cluster. "+
|
||||
"Please edit the 'featureGates' field of ClusterConfiguration which is defined in the %s/%s ConfigMap instead.", metav1.NamespaceSystem, kubeadmconstants.KubeadmConfigConfigMap))
|
||||
options.AddIgnorePreflightErrorsFlag(fs, &flags.ignorePreflightErrors)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user