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.
This commit is contained in:
Aaron U'Ren 2024-11-17 12:10:47 -06:00 committed by Manuel Rüger
parent ec9ab9425d
commit d867a79e6b

View File

@ -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
}