Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions go-controller/pkg/clustermanager/egressip_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func (h *egressIPClusterControllerEventHandler) UpdateResource(oldObj, newObj in
isNewReady := h.eIPC.isEgressNodeReady(newNode)
isNewReachable := h.eIPC.isEgressNodeReachable(newNode)
isHostCIDRsAltered := util.NodeHostCIDRsAnnotationChanged(oldNode, newNode)
isCloudEgressIPConfigAltered := util.CloudEgressIPConfigAnnotationChanged(oldNode, newNode)
h.eIPC.setNodeEgressReady(newNode.Name, isNewReady)
if !oldHadEgressLabel && newHasEgressLabel {
klog.Infof("Node: %s has been labeled, adding it for egress assignment", newNode.Name)
Expand All @@ -142,7 +143,7 @@ func (h *egressIPClusterControllerEventHandler) UpdateResource(oldObj, newObj in
}
return nil
}
if isOldReady == isNewReady && !isHostCIDRsAltered {
if isOldReady == isNewReady && !isHostCIDRsAltered && !isCloudEgressIPConfigAltered {
return nil
}
if !isNewReady {
Expand All @@ -151,7 +152,16 @@ func (h *egressIPClusterControllerEventHandler) UpdateResource(oldObj, newObj in
return err
}
} else if isNewReady && isNewReachable {
klog.Infof("Node: %s is ready and reachable, adding it for egress assignment", newNode.Name)
if isCloudEgressIPConfigAltered {
// When cloud-network-config-controller updates the egress IP config
// annotation (e.g., adding an IPv6 subnet that was previously missing
// because the subnet's IPv6 CIDR was not yet in "associated" state),
// the node's egress IP capacity may have changed. Log this explicitly
// so operators can correlate annotation changes with re-assignments.
klog.Infof("Node: %s cloud egress IP config annotation changed, re-evaluating egress IP assignments", newNode.Name)
} else {
klog.Infof("Node: %s is ready and reachable, adding it for egress assignment", newNode.Name)
}
h.eIPC.setNodeEgressReachable(newNode.Name, isNewReachable)
if err := h.eIPC.addEgressNode(newNode.Name); err != nil {
return err
Expand Down
8 changes: 8 additions & 0 deletions go-controller/pkg/util/node_annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,14 @@ func NodeHostCIDRsAnnotationChanged(oldNode, newNode *corev1.Node) bool {
return oldNode.Annotations[OVNNodeHostCIDRs] != newNode.Annotations[OVNNodeHostCIDRs]
}

// CloudEgressIPConfigAnnotationChanged returns true if the cloud egress IP
// configuration annotation changed between oldNode and newNode. This annotation
// is managed by cloud-network-config-controller and carries the IPv4/IPv6
// subnets and capacity for egress IP assignment on cloud platforms.
func CloudEgressIPConfigAnnotationChanged(oldNode, newNode *corev1.Node) bool {
return oldNode.Annotations[cloudEgressIPConfigAnnotationKey] != newNode.Annotations[cloudEgressIPConfigAnnotationKey]
}

// ParseNodeHostCIDRs returns the parsed host CIDRS living on a node
func ParseNodeHostCIDRs(node *corev1.Node) (sets.Set[string], error) {
addrAnnotation, ok := node.Annotations[OVNNodeHostCIDRs]
Expand Down