Skip to content

Commit c0fad85

Browse files
committed
Remove NetworkUnavailable condition from node
The NodeNetworkUnavailable condition can be set after ovn-k processed the node successfully so we cannot do the early exit without checking for this. Order of events: 1. Node is added without the NodeNetworkUnavailable condition 2. OVN-Kubernetes reconciles the node 3. Condition is added by an external entity 4. We never remove it because we exit early Hence this commit adds NodeNetworkUnavailable condition check for node update event and ensures h.clearInitialNodeNetworkUnavailableCondition method is called at least once to clear this condition. Signed-off-by: Periyasamy Palanisamy <[email protected]>
1 parent 6082160 commit c0fad85

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

go-controller/pkg/clustermanager/network_cluster_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
cache "k8s.io/client-go/tools/cache"
1717
"k8s.io/client-go/tools/record"
1818
"k8s.io/client-go/util/retry"
19+
k8snodeutil "k8s.io/component-helpers/node/util"
1920
"k8s.io/klog/v2"
2021

2122
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/allocator/id"
@@ -576,7 +577,10 @@ func (h *networkClusterControllerEventHandler) UpdateResource(oldObj, newObj int
576577
// 1. we missed an add event (bug in kapi informer code)
577578
// 2. a user removed the annotation on the node
578579
// 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) {
580+
_, nodeCondition := k8snodeutil.GetNodeCondition(&newNode.Status, corev1.NodeNetworkUnavailable)
581+
nodeNetworkUnavailable := nodeCondition != nil && nodeCondition.Status == corev1.ConditionTrue
582+
if !nodeFailed && util.NoHostSubnet(oldNode) == util.NoHostSubnet(newNode) &&
583+
!h.ncc.nodeAllocator.NeedsNodeAllocation(newNode) && !nodeNetworkUnavailable {
580584
// no other node updates would require us to reconcile again
581585
return nil
582586
}

0 commit comments

Comments
 (0)