From 0ab006b8a1e18b998e112b91fa5d7d868b577f68 Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Sat, 17 Feb 2024 18:56:14 +0000 Subject: [PATCH] node-controller reconcile node labels on each update 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 --- .../cloud-provider/controllers/node/node_controller.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/staging/src/k8s.io/cloud-provider/controllers/node/node_controller.go b/staging/src/k8s.io/cloud-provider/controllers/node/node_controller.go index 8924e9fa3b1..3374b89ad56 100644 --- a/staging/src/k8s.io/cloud-provider/controllers/node/node_controller.go +++ b/staging/src/k8s.io/cloud-provider/controllers/node/node_controller.go @@ -283,11 +283,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) @@ -423,9 +418,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)