Skip to content

Commit 61b1bf9

Browse files
committed
Add control-plane label for master nodes on legacy clusters
blah
1 parent 36a1298 commit 61b1bf9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/controller/node/node_controller.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ import (
5555
const (
5656
// WorkerLabel defines the label associated with worker node.
5757
WorkerLabel = "node-role.kubernetes.io/worker"
58+
// ControlPlaneLabel defines the label associated with master/control-plane node.
59+
ControlPlaneLabel = "node-role.kubernetes.io/control-plane"
5860

5961
// maxRetries is the number of times a machineconfig pool will be retried before it is dropped out of the queue.
6062
// With the current rate-limiter in use (5ms*2^(maxRetries-1)) the following numbers represent the times
@@ -321,7 +323,6 @@ func (ctrl *Controller) makeMastersUnSchedulable(currentMasters []*corev1.Node)
321323
}
322324
}
323325
return errs
324-
325326
}
326327

327328
// makeMasterNodeUnSchedulable makes master node unschedulable by removing worker label and adding `NoSchedule`
@@ -363,6 +364,12 @@ func (ctrl *Controller) makeMasterNodeSchedulable(node *corev1.Node) error {
363364
if _, hasWorkerLabel := newLabels[WorkerLabel]; !hasWorkerLabel {
364365
newLabels[WorkerLabel] = ""
365366
}
367+
// Legacy clusters do not have the node-role.kubernetes.io/control-plane
368+
// label. When master nodes go schedulable again, let's add the
369+
// control-plane label.
370+
if _, hasControlPlaneLabel := newLabels[ControlPlaneLabel]; !hasControlPlaneLabel {
371+
newLabels[ControlPlaneLabel] = ""
372+
}
366373
node.Labels = newLabels
367374
// Remove master taint
368375
newTaints := []corev1.Taint{}

0 commit comments

Comments
 (0)