mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
Merge pull request #124715 from SataQiu/fix-kubeadm-20240507
kubeadm: remove deprecated UpgradeAddonsBeforeControlPlane featuregate
This commit is contained in:
commit
78bc18dcb0
@ -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,11 +78,9 @@ 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")
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("[upgrade] The control plane instance for this node was successfully updated!")
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
@ -51,10 +49,6 @@ var InitFeatureGates = FeatureList{
|
||||
},
|
||||
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.",
|
||||
},
|
||||
WaitForAllControlPlaneComponents: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}},
|
||||
}
|
||||
|
||||
|
@ -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,31 +113,16 @@ 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)
|
||||
}
|
||||
|
||||
var errs []error
|
||||
|
||||
// If the coredns ConfigMap is missing, show a warning and assume that the
|
||||
|
Loading…
Reference in New Issue
Block a user