integ/kubernetes/kubernetes-1.24.4/debian/deb_folder/patches/Revert-kubeadm-apply-the-ne...

87 lines
3.4 KiB
Diff

From 2c9b24f312305a29de2c861a35c3ec18b4ad3994 Mon Sep 17 00:00:00 2001
From: Jim Gauld <James.Gauld@windriver.com>
Date: Wed, 12 Oct 2022 13:59:48 -0400
Subject: [PATCH 2/5] Revert "kubeadm: apply the new "control-plane" taint
during upgrade"
This reverts commit db6061f5a6e6eb0002d572fa5ab1142e9b60bc1b.
---
cmd/kubeadm/app/cmd/upgrade/apply.go | 9 -----
cmd/kubeadm/app/phases/upgrade/postupgrade.go | 40 -------------------
2 files changed, 49 deletions(-)
diff --git a/cmd/kubeadm/app/cmd/upgrade/apply.go b/cmd/kubeadm/app/cmd/upgrade/apply.go
index 042f10796b6..3644146d804 100644
--- a/cmd/kubeadm/app/cmd/upgrade/apply.go
+++ b/cmd/kubeadm/app/cmd/upgrade/apply.go
@@ -163,15 +163,6 @@ func runApply(flags *applyFlags, args []string) error {
return err
}
- // TODO: https://github.com/kubernetes/kubeadm/issues/2200
- fmt.Printf("[upgrade/postupgrade] Adding the new taint %s to all control plane Nodes. "+
- "After this step both taints %s and %s should be present on control plane Nodes.\n",
- kubeadmconstants.ControlPlaneTaint.String(), kubeadmconstants.ControlPlaneTaint.String(),
- kubeadmconstants.OldControlPlaneTaint.String())
- if err := upgrade.AddNewControlPlaneTaint(client); err != nil {
- return err
- }
-
// Upgrade RBAC rules and addons.
klog.V(1).Infoln("[upgrade/postupgrade] upgrading RBAC rules and addons")
if err := upgrade.PerformPostUpgradeTasks(client, cfg, flags.dryRun); err != nil {
diff --git a/cmd/kubeadm/app/phases/upgrade/postupgrade.go b/cmd/kubeadm/app/phases/upgrade/postupgrade.go
index 55828597310..fa215bfedf8 100644
--- a/cmd/kubeadm/app/phases/upgrade/postupgrade.go
+++ b/cmd/kubeadm/app/phases/upgrade/postupgrade.go
@@ -238,46 +238,6 @@ func RemoveOldControlPlaneLabel(client clientset.Interface) error {
return nil
}
-// AddNewControlPlaneTaint finds all nodes with the new "control-plane" node-role label
-// and adds the new "control-plane" taint to them.
-// TODO: https://github.com/kubernetes/kubeadm/issues/2200
-func AddNewControlPlaneTaint(client clientset.Interface) error {
- selectorControlPlane := labels.SelectorFromSet(labels.Set(map[string]string{
- kubeadmconstants.LabelNodeRoleControlPlane: "",
- }))
- nodes, err := client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{
- LabelSelector: selectorControlPlane.String(),
- })
- if err != nil {
- return errors.Wrapf(err, "could not list nodes labeled with %q", kubeadmconstants.LabelNodeRoleControlPlane)
- }
-
- for _, n := range nodes.Items {
- // Check if the node has the old / new taints
- hasOldTaint := false
- hasNewTaint := false
- for _, t := range n.Spec.Taints {
- switch t.String() {
- case kubeadmconstants.OldControlPlaneTaint.String():
- hasOldTaint = true
- case kubeadmconstants.ControlPlaneTaint.String():
- hasNewTaint = true
- }
- }
- // If the old taint is present and the new taint is missing, patch the node with the new taint.
- // When the old taint is missing, assume the user has manually untainted the node and take no action.
- if !hasNewTaint && hasOldTaint {
- err = apiclient.PatchNode(client, n.Name, func(n *v1.Node) {
- n.Spec.Taints = append(n.Spec.Taints, kubeadmconstants.ControlPlaneTaint)
- })
- if err != nil {
- return err
- }
- }
- }
- return nil
-}
-
// UpdateKubeletDynamicEnvFileWithURLScheme reads the kubelet dynamic environment file
// from disk, ensure that the CRI endpoint flag has a scheme prefix and writes it
// back to disk.
--
2.25.1