Skip to content

Instantly share code, notes, and snippets.

@flavio-fernandes
Created March 14, 2022 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flavio-fernandes/751091b6a75dad0b68493813c5c1dac0 to your computer and use it in GitHub Desktop.
Save flavio-fernandes/751091b6a75dad0b68493813c5c1dac0 to your computer and use it in GitHub Desktop.
checking for no valid nexthops
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