From 182ac47161bd8a82d86db4053ded366794d7b9a8 Mon Sep 17 00:00:00 2001 From: Saurab Sonigra Date: Wed, 22 Jul 2026 11:11:30 +0530 Subject: [PATCH] OCPBUGS-64575: Refresh egress IP capacity annotation on informer resync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The node controller's UpdateFunc only enqueued nodes when taints changed. The 2-minute informer resync fires UpdateFunc with old==new (same cached object), but since taints never differ in that case, the node was never re-enqueued. This meant SyncHandler — which makes live cloud API calls to calculate current IP capacity — only ran once at node add time. As a result, the cloud.network.openshift.io/egress-ipconfig annotation became stale immediately after the initial calculation. When EgressIPs were assigned or released (changing the ENI's IP count), the annotation continued to report the original capacity. This caused ovn-kubernetes to make incorrect assignment decisions based on outdated capacity data. Fix: detect informer resync events (where old and new have the same ResourceVersion) and enqueue the node so SyncHandler re-queries the cloud API with the current set of CPIC-managed IPs, producing an accurate capacity annotation. Signed-off-by: Saurab Sonigra --- pkg/controller/node/node_controller.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/controller/node/node_controller.go b/pkg/controller/node/node_controller.go index 47cc4497b..88307a6f4 100644 --- a/pkg/controller/node/node_controller.go +++ b/pkg/controller/node/node_controller.go @@ -78,11 +78,20 @@ func NewNodeController( _, err := nodeInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: controller.Enqueue, UpdateFunc: func(oldN, newN interface{}) { + oldNode, _ := oldN.(*corev1.Node) + newNode, _ := newN.(*corev1.Node) + // Enqueue on informer resync (same ResourceVersion means the object hasn't changed + // in the API server — the informer is just re-delivering the cached object). + // This ensures SyncHandler periodically re-queries the cloud API for current + // capacity, keeping the egress-ipconfig annotation up to date as IPs are + // assigned or released. + if oldNode.ResourceVersion == newNode.ResourceVersion { + controller.Enqueue(newN) + return + } // Enqueue when an update to the node's taints occurred - for external cloud providers, we must // catch changes to taint node.cloudprovider.kubernetes.io/uninitialized. // See https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/ - oldNode, _ := oldN.(*corev1.Node) - newNode, _ := newN.(*corev1.Node) if !reflect.DeepEqual(oldNode.Spec.Taints, newNode.Spec.Taints) { controller.Enqueue(newN) }