diff --git a/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go b/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go index 3fa27fc2df5..e396efc61d5 100644 --- a/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go +++ b/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go @@ -79,7 +79,7 @@ func runControlPlane() func(c workflow.RunData) error { return errors.Wrap(err, "couldn't complete the static pod upgrade") } - if features.Enabled(cfg.FeatureGates, features.UpgradeAddonsAfterControlPlane) { + 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") } diff --git a/cmd/kubeadm/app/features/features.go b/cmd/kubeadm/app/features/features.go index 93ecae6f851..dc4d476b39b 100644 --- a/cmd/kubeadm/app/features/features.go +++ b/cmd/kubeadm/app/features/features.go @@ -35,16 +35,16 @@ const ( RootlessControlPlane = "RootlessControlPlane" // EtcdLearnerMode is expected to be in alpha in v1.27 EtcdLearnerMode = "EtcdLearnerMode" - // UpgradeAddonsAfterControlPlane is expected to be in alpha in v1.28 - UpgradeAddonsAfterControlPlane = "UpgradeAddonsAfterControlPlane" + // UpgradeAddonsBeforeControlPlane is expected to be in deprecated in v1.28 and will be removed in future release + UpgradeAddonsBeforeControlPlane = "UpgradeAddonsBeforeControlPlane" ) // InitFeatureGates are the default feature gates for the init command var InitFeatureGates = FeatureList{ - PublicKeysECDSA: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, - RootlessControlPlane: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, - EtcdLearnerMode: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, - UpgradeAddonsAfterControlPlane: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, + PublicKeysECDSA: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, + RootlessControlPlane: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, + EtcdLearnerMode: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, + UpgradeAddonsBeforeControlPlane: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Deprecated}}, } // Feature represents a feature being gated diff --git a/cmd/kubeadm/app/phases/upgrade/postupgrade.go b/cmd/kubeadm/app/phases/upgrade/postupgrade.go index 2d39eeba937..1e22a076eec 100644 --- a/cmd/kubeadm/app/phases/upgrade/postupgrade.go +++ b/cmd/kubeadm/app/phases/upgrade/postupgrade.go @@ -114,28 +114,28 @@ func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.InitCon } // PerformAddonsUpgrade performs the upgrade of the coredns and kube-proxy addons. -// When UpgradeAddonsAfterControlPlane feature gate is disabled, the addons will be upgraded immediately. -// When UpgradeAddonsAfterControlPlane feature gate is enabled, the addons will only get updated after all the control plane instances have been upgraded. +// 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.UpgradeAddonsAfterControlPlane) { + if !features.Enabled(cfg.FeatureGates, features.UpgradeAddonsBeforeControlPlane) { return err } - // when UpgradeAddonsAfterControlPlane feature gate is disabled, just throw a warning + // when UpgradeAddonsBeforeControlPlane feature gate is enabled, just throw a warning klog.V(1).Info(err) } if len(unupgradedControlPlanes) > 0 { - if features.Enabled(cfg.FeatureGates, features.UpgradeAddonsAfterControlPlane) { + 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 UpgradeAddonsAfterControlPlane feature gate is disabled, just throw a warning + // 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 enable the UpgradeAddonsAfterControlPlane feature gate to"+ + "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) }