Skip to content

Commit

Permalink
Merge pull request kubernetes#110111 from neolit123/1.25-update-maste…
Browse files Browse the repository at this point in the history
…r-label-taint

kubeadm: remove RemoveOldControlPlaneLabel
  • Loading branch information
k8s-ci-robot committed May 18, 2022
2 parents a1c8e93 + 80e5bca commit 92285fd
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions cmd/kubeadm/app/phases/upgrade/postupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92285fd

Please sign in to comment.