Merge pull request #110111 from neolit123/1.25-update-master-label-taint

kubeadm: remove RemoveOldControlPlaneLabel
This commit is contained in:
Kubernetes Prow Robot 2022-05-18 09:54:54 -07:00 committed by GitHub
commit 92285fd74e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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