mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +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/options"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
|
"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/phases/upgrade"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient"
|
"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")
|
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 {
|
||||||
if err := upgrade.PerformAddonsUpgrade(client, cfg, data.OutputWriter()); err != nil {
|
return errors.Wrap(err, "failed to perform addons upgrade")
|
||||||
return errors.Wrap(err, "failed to perform addons upgrade")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("[upgrade] The control plane instance for this node was successfully updated!")
|
fmt.Println("[upgrade] The control plane instance for this node was successfully updated!")
|
||||||
|
@ -36,8 +36,6 @@ const (
|
|||||||
RootlessControlPlane = "RootlessControlPlane"
|
RootlessControlPlane = "RootlessControlPlane"
|
||||||
// EtcdLearnerMode is expected to be in alpha in v1.27, beta in v1.29
|
// EtcdLearnerMode is expected to be in alpha in v1.27, beta in v1.29
|
||||||
EtcdLearnerMode = "EtcdLearnerMode"
|
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 is expected to be alpha in v1.30
|
||||||
WaitForAllControlPlaneComponents = "WaitForAllControlPlaneComponents"
|
WaitForAllControlPlaneComponents = "WaitForAllControlPlaneComponents"
|
||||||
)
|
)
|
||||||
@ -49,12 +47,8 @@ var InitFeatureGates = FeatureList{
|
|||||||
DeprecationMessage: "The PublicKeysECDSA feature gate is deprecated and will be removed when v1beta3 is removed." +
|
DeprecationMessage: "The PublicKeysECDSA feature gate is deprecated and will be removed when v1beta3 is removed." +
|
||||||
" v1beta4 supports a new option 'ClusterConfiguration.EncryptionAlgorithm'.",
|
" v1beta4 supports a new option 'ClusterConfiguration.EncryptionAlgorithm'.",
|
||||||
},
|
},
|
||||||
RootlessControlPlane: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}},
|
RootlessControlPlane: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}},
|
||||||
EtcdLearnerMode: {FeatureSpec: featuregate.FeatureSpec{Default: true, PreRelease: featuregate.Beta}},
|
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}},
|
WaitForAllControlPlaneComponents: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ import (
|
|||||||
|
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
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/dns"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/phases/addons/proxy"
|
"k8s.io/kubernetes/cmd/kubeadm/app/phases/addons/proxy"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/phases/bootstraptoken/clusterinfo"
|
"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.
|
// 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 {
|
func PerformAddonsUpgrade(client clientset.Interface, cfg *kubeadmapi.InitConfiguration, out io.Writer) error {
|
||||||
unupgradedControlPlanes, err := unupgradedControlPlaneInstances(client, cfg.NodeRegistration.Name)
|
unupgradedControlPlanes, err := unupgradedControlPlaneInstances(client, cfg.NodeRegistration.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = errors.Wrapf(err, "failed to determine whether all the control plane instances have been upgraded")
|
return 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)
|
|
||||||
}
|
}
|
||||||
if len(unupgradedControlPlanes) > 0 {
|
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)
|
||||||
fmt.Fprintf(out, "[upgrade/addons] skip upgrade addons because control plane instances %v have not been upgraded\n", unupgradedControlPlanes)
|
return nil
|
||||||
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
|
var errs []error
|
||||||
|
Loading…
Reference in New Issue
Block a user