Skip to content

Commit

Permalink
node-controller reconcile node labels on each update
Browse files Browse the repository at this point in the history
instead of waiting for the periodic loop of the node-controller to
go through all the nodes, use the sync logic to reconcile the node
labels each time that the node has changed after it has been
initialized.

This has the benefit that changes by external entities on this labels
are quickly reconciled.

Change-Id: I45cfc1e3f0b9eefdfdd67267229420d76132ab87

Kubernetes-commit: 0ab006b8a1e18b998e112b91fa5d7d868b577f68
  • Loading branch information
aojea authored and k8s-publishing-bot committed Feb 17, 2024
1 parent 4002efb commit 57b2532
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions controllers/node/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,6 @@ func (cnc *CloudNodeController) UpdateNodeStatus(ctx context.Context) error {
}

cnc.updateNodeAddress(ctx, node, instanceMetadata)

err = cnc.reconcileNodeLabels(node.Name)
if err != nil {
klog.Errorf("Error reconciling node labels for node %q, err: %v", node.Name, err)
}
}

workqueue.ParallelizeUntil(ctx, int(cnc.workerCount), len(nodes), updateNodeFunc)
Expand Down Expand Up @@ -424,9 +419,8 @@ func (cnc *CloudNodeController) syncNode(ctx context.Context, nodeName string) e

cloudTaint := getCloudTaint(curNode.Spec.Taints)
if cloudTaint == nil {
// Node object received from event had the cloud taint but was outdated,
// the node has actually already been initialized, so this sync event can be ignored.
return nil
// Node object was already initialized, only need to reconcile the labels
return cnc.reconcileNodeLabels(nodeName)
}

klog.Infof("Initializing node %s with cloud provider", nodeName)
Expand Down

0 comments on commit 57b2532

Please sign in to comment.