From d867a79e6b96be0d166161fabca3aed81faebf5f Mon Sep 17 00:00:00 2001 From: Aaron U'Ren Date: Sun, 17 Nov 2024 12:10:47 -0600 Subject: [PATCH] fix(injectRoute): ensure routes is removed from map There are a couple of items that have typically ended up in a no-op for us when considering routes to inject. However, now that we have a route map where we track route state, we need this not just to be no-ops, but also update the route state cache as well to ensure that the route doesn't get replaced in the future. When we find tunnels to clean up, we need to not only remove the tunnel and the route to that tunnel, but also remove the route from the state map. When we discover that no route needs to be added to the host because it's not in the same subnet and we weren't supposed to create a tunnel, then we also clean it up and ensure that it isn't in our state as well. --- pkg/controllers/routing/network_routes_controller.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/controllers/routing/network_routes_controller.go b/pkg/controllers/routing/network_routes_controller.go index 9bb69a67..77a92f0c 100644 --- a/pkg/controllers/routing/network_routes_controller.go +++ b/pkg/controllers/routing/network_routes_controller.go @@ -659,6 +659,7 @@ func (nrc *NetworkRoutingController) injectRoute(path *gobgpapi.Path) error { } else { // knowing that a tunnel shouldn't exist for this route, check to see if there are any lingering tunnels / // routes that need to be cleaned up. + nrc.routeSyncer.DelInjectedRoute(dst) tunnels.CleanupTunnel(dst, tunnelName) } @@ -700,6 +701,7 @@ func (nrc *NetworkRoutingController) injectRoute(path *gobgpapi.Path) error { } default: // otherwise, let BGP do its thing, nothing to do here + nrc.routeSyncer.DelInjectedRoute(dst) return nil }