From 80e5bcae9b885179446fa27fa3b4da0992c1b8a8 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 18 May 2022 15:42:08 +0300 Subject: [PATCH] kubeadm: remove RemoveOldControlPlaneLabel The function is no longer used and was missed in a 1.25 cleanup PR. --- cmd/kubeadm/app/phases/upgrade/postupgrade.go | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/cmd/kubeadm/app/phases/upgrade/postupgrade.go b/cmd/kubeadm/app/phases/upgrade/postupgrade.go index 4e39ba88a27..aad71841736 100644 --- a/cmd/kubeadm/app/phases/upgrade/postupgrade.go +++ b/cmd/kubeadm/app/phases/upgrade/postupgrade.go @@ -207,30 +207,6 @@ func rollbackFiles(files map[string]string, originalErr error) error { return errors.Errorf("couldn't move these files: %v. Got errors: %v", files, errorsutil.NewAggregate(errs)) } -// RemoveOldControlPlaneLabel finds all nodes with the legacy node-role label and removes it -// TODO: https://github.com/kubernetes/kubeadm/issues/2200 -func RemoveOldControlPlaneLabel(client clientset.Interface) error { - selectorOldControlPlane := labels.SelectorFromSet(labels.Set(map[string]string{ - kubeadmconstants.LabelNodeRoleOldControlPlane: "", - })) - nodesWithOldLabel, err := client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{ - LabelSelector: selectorOldControlPlane.String(), - }) - if err != nil { - return errors.Wrapf(err, "could not list nodes labeled with %q", kubeadmconstants.LabelNodeRoleOldControlPlane) - } - - for _, n := range nodesWithOldLabel.Items { - err = apiclient.PatchNode(client, n.Name, func(n *v1.Node) { - delete(n.ObjectMeta.Labels, kubeadmconstants.LabelNodeRoleOldControlPlane) - }) - if err != nil { - return err - } - } - return nil -} - // RemoveOldControlPlaneTaint finds all nodes with the new "control-plane" node-role label // and removes the old "control-plane" taint to them. // TODO: https://github.com/kubernetes/kubeadm/issues/2200