From 6f9470088665a8a83cdcecb60c97dc54992c6722 Mon Sep 17 00:00:00 2001 From: SataQiu Date: Tue, 7 May 2024 09:24:10 +0800 Subject: [PATCH] kubeadm: remove deprecated UpgradeAddonsBeforeControlPlane featuregate --- .../cmd/phases/upgrade/node/controlplane.go | 7 ++---- cmd/kubeadm/app/features/features.go | 10 ++------- cmd/kubeadm/app/phases/upgrade/postupgrade.go | 22 +++---------------- 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go b/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go index 5b58c325a70..60480f353e8 100644 --- a/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go +++ b/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go @@ -24,7 +24,6 @@ import ( "k8s.io/kubernetes/cmd/kubeadm/app/cmd/options" "k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow" - "k8s.io/kubernetes/cmd/kubeadm/app/features" "k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade" "k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient" ) @@ -79,10 +78,8 @@ func runControlPlane() func(c workflow.RunData) error { return errors.Wrap(err, "couldn't complete the static pod upgrade") } - if !features.Enabled(cfg.FeatureGates, features.UpgradeAddonsBeforeControlPlane) { - if err := upgrade.PerformAddonsUpgrade(client, cfg, data.OutputWriter()); err != nil { - return errors.Wrap(err, "failed to perform addons upgrade") - } + if err := upgrade.PerformAddonsUpgrade(client, cfg, data.OutputWriter()); err != nil { + return errors.Wrap(err, "failed to perform addons upgrade") } fmt.Println("[upgrade] The control plane instance for this node was successfully updated!") diff --git a/cmd/kubeadm/app/features/features.go b/cmd/kubeadm/app/features/features.go index f3c28bb396f..b176d59e680 100644 --- a/cmd/kubeadm/app/features/features.go +++ b/cmd/kubeadm/app/features/features.go @@ -36,8 +36,6 @@ const ( RootlessControlPlane = "RootlessControlPlane" // EtcdLearnerMode is expected to be in alpha in v1.27, beta in v1.29 EtcdLearnerMode = "EtcdLearnerMode" - // UpgradeAddonsBeforeControlPlane is expected to be in deprecated in v1.28 and will be removed in future release - UpgradeAddonsBeforeControlPlane = "UpgradeAddonsBeforeControlPlane" // WaitForAllControlPlaneComponents is expected to be alpha in v1.30 WaitForAllControlPlaneComponents = "WaitForAllControlPlaneComponents" ) @@ -49,12 +47,8 @@ var InitFeatureGates = FeatureList{ DeprecationMessage: "The PublicKeysECDSA feature gate is deprecated and will be removed when v1beta3 is removed." + " v1beta4 supports a new option 'ClusterConfiguration.EncryptionAlgorithm'.", }, - RootlessControlPlane: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, - EtcdLearnerMode: {FeatureSpec: featuregate.FeatureSpec{Default: true, PreRelease: featuregate.Beta}}, - UpgradeAddonsBeforeControlPlane: { - FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Deprecated}, - DeprecationMessage: "The UpgradeAddonsBeforeControlPlane feature gate is deprecated and will be removed in a future release.", - }, + RootlessControlPlane: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, + EtcdLearnerMode: {FeatureSpec: featuregate.FeatureSpec{Default: true, PreRelease: featuregate.Beta}}, WaitForAllControlPlaneComponents: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, } diff --git a/cmd/kubeadm/app/phases/upgrade/postupgrade.go b/cmd/kubeadm/app/phases/upgrade/postupgrade.go index 3df38b12bce..0bc227c23a6 100644 --- a/cmd/kubeadm/app/phases/upgrade/postupgrade.go +++ b/cmd/kubeadm/app/phases/upgrade/postupgrade.go @@ -35,7 +35,6 @@ import ( kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants" - "k8s.io/kubernetes/cmd/kubeadm/app/features" "k8s.io/kubernetes/cmd/kubeadm/app/phases/addons/dns" "k8s.io/kubernetes/cmd/kubeadm/app/phases/addons/proxy" "k8s.io/kubernetes/cmd/kubeadm/app/phases/bootstraptoken/clusterinfo" @@ -114,29 +113,14 @@ func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.InitCon } // PerformAddonsUpgrade performs the upgrade of the coredns and kube-proxy addons. -// When UpgradeAddonsBeforeControlPlane feature gate is enabled, the addons will be upgraded immediately. -// When UpgradeAddonsBeforeControlPlane feature gate is disabled, the addons will only get updated after all the control plane instances have been upgraded. func PerformAddonsUpgrade(client clientset.Interface, cfg *kubeadmapi.InitConfiguration, out io.Writer) error { unupgradedControlPlanes, err := unupgradedControlPlaneInstances(client, cfg.NodeRegistration.Name) if err != nil { - err = errors.Wrapf(err, "failed to determine whether all the control plane instances have been upgraded") - if !features.Enabled(cfg.FeatureGates, features.UpgradeAddonsBeforeControlPlane) { - return err - } - - // when UpgradeAddonsBeforeControlPlane feature gate is enabled, just throw a warning - klog.V(1).Info(err) + return errors.Wrapf(err, "failed to determine whether all the control plane instances have been upgraded") } if len(unupgradedControlPlanes) > 0 { - if !features.Enabled(cfg.FeatureGates, features.UpgradeAddonsBeforeControlPlane) { - fmt.Fprintf(out, "[upgrade/addons] skip upgrade addons because control plane instances %v have not been upgraded\n", unupgradedControlPlanes) - return nil - } - - // when UpgradeAddonsBeforeControlPlane feature gate is enabled, just throw a warning - klog.V(1).Infof("upgrading addons when control plane instances %v have not been upgraded "+ - "may lead to incompatibility problems. You can disable the UpgradeAddonsBeforeControlPlane feature gate to "+ - "ensure that the addons upgrade is executed only when all the control plane instances have been upgraded.", unupgradedControlPlanes) + fmt.Fprintf(out, "[upgrade/addons] skip upgrade addons because control plane instances %v have not been upgraded\n", unupgradedControlPlanes) + return nil } var errs []error