Skip to content

Commit b31c67a

Browse files
authored
Merge pull request #5275 from trozet/fix_node_update
Fix node update check for network cluster controller
2 parents c01e2ec + 2b812dd commit b31c67a

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

go-controller/pkg/clustermanager/network_cluster_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ func (h *networkClusterControllerEventHandler) UpdateResource(oldObj, newObj int
576576
// 1. we missed an add event (bug in kapi informer code)
577577
// 2. a user removed the annotation on the node
578578
// Either way to play it safe for now do a partial json unmarshal check
579-
if !nodeFailed && util.NoHostSubnet(oldNode) != util.NoHostSubnet(newNode) && !h.ncc.nodeAllocator.NeedsNodeAllocation(newNode) {
579+
if !nodeFailed && util.NoHostSubnet(oldNode) == util.NoHostSubnet(newNode) && !h.ncc.nodeAllocator.NeedsNodeAllocation(newNode) {
580580
// no other node updates would require us to reconcile again
581581
return nil
582582
}

go-controller/pkg/clustermanager/node/node_allocator.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,27 +195,24 @@ func (na *NodeAllocator) NeedsNodeAllocation(node *corev1.Node) bool {
195195
}
196196

197197
// ovn node check
198-
// allocation is all or nothing, so if one field was allocated from:
199-
// nodeSubnets, joinSubnet, layer 2 tunnel id, then all of them were
200198
if na.hasNodeSubnetAllocation() {
201-
if util.HasNodeHostSubnetAnnotation(node, na.netInfo.GetNetworkName()) {
202-
return false
199+
if !util.HasNodeHostSubnetAnnotation(node, na.netInfo.GetNetworkName()) {
200+
return true
203201
}
204202
}
205-
206203
if na.hasJoinSubnetAllocation() {
207-
if util.HasNodeGatewayRouterJoinNetwork(node, na.netInfo.GetNetworkName()) {
208-
return false
204+
if !util.HasNodeGatewayRouterJoinNetwork(node, na.netInfo.GetNetworkName()) {
205+
return true
209206
}
210207
}
211208

212209
if util.IsNetworkSegmentationSupportEnabled() && na.netInfo.IsPrimaryNetwork() && util.DoesNetworkRequireTunnelIDs(na.netInfo) {
213-
if util.HasUDNLayer2NodeGRLRPTunnelID(node, na.netInfo.GetNetworkName()) {
214-
return false
210+
if !util.HasUDNLayer2NodeGRLRPTunnelID(node, na.netInfo.GetNetworkName()) {
211+
return true
215212
}
216213
}
217214

218-
return true
215+
return false
219216

220217
}
221218

0 commit comments

Comments
 (0)