Created
March 14, 2022 20:14
-
-
Save flavio-fernandes/751091b6a75dad0b68493813c5c1dac0 to your computer and use it in GitHub Desktop.
checking for no valid nexthops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/go-controller/pkg/ovn/egressip.go b/go-controller/pkg/ovn/egressip.go | |
index 5d524a8a3..262c00522 100644 | |
--- a/go-controller/pkg/ovn/egressip.go | |
+++ b/go-controller/pkg/ovn/egressip.go | |
@@ -1148,13 +1148,21 @@ func (oc *Controller) syncStaleEgressReroutePolicy(egressIPCache map[string]egre | |
return true | |
} | |
// Check for stale nexthops that may exist in the logical router policy and store that in logicalRouterPolicyStaleNexthops | |
+ onlyStaleNextHops := true | |
staleNextHops := sets.NewString() | |
for _, nexthop := range lrp.Nexthops { | |
if !cacheEntry.gatewayRouterIPs.Has(nexthop) { | |
staleNextHops.Insert(nexthop) | |
+ } else { | |
+ onlyStaleNextHops = false | |
} | |
} | |
if staleNextHops.Len() > 0 { | |
+ // If all nexthops are stale, let's go ahead and remove the entire row | |
+ if onlyStaleNextHops { | |
+ klog.Infof("syncStaleEgressReroutePolicy will delete %s due to stale nexthops: %v", egressIPName, lrp) | |
+ return true | |
+ } | |
logicalRouterPolicyStaleNexthops[lrp.UUID] = nbdb.LogicalRouterPolicy{ | |
UUID: lrp.UUID, | |
Nexthops: staleNextHops.UnsortedList(), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment