Skip to content

fix(gateway): withdraw advertisements when a gateway node is removed - #420

Merged
privateip merged 1 commit into
mainfrom
fix/issue-406
Aug 16, 2026
Merged

fix(gateway): withdraw advertisements when a gateway node is removed#420
privateip merged 1 commit into
mainfrom
fix/issue-406

Conversation

@privateip

Copy link
Copy Markdown
Contributor

Summary

When a gateway node was removed, the BGPAdvertisements it created — its self-address route and its per-rule VIP routes — stayed in the BGP mesh with no forwarding behind them. Traffic kept being drawn toward a node that could no longer serve it, while every control plane signal an operator would check still reported the route as healthy. This is issue #367's teardown fix in the other direction: that fix withdrew a deleted rule's advertisements regardless of which node made them; this withdraws a departed node's advertisements regardless of which rule they were for.

Test plan

  • Build, lint, and unit tests pass
  • Deleting a gateway node's NetworkGateway withdraws its self-address and per-rule advertisements
  • A surviving node's own advertisements are untouched when a sibling node is removed

Fixes #406

Deleting a gateway node's NetworkGateway stopped its datapath engine and
marked it Terminating, but never withdrew the BGPAdvertisements it had
created: its self-address route and its per-rule, per-address-family VIP
routes. The route stayed in the mesh advertising a node with nothing
behind it, so traffic kept being drawn toward a node that could no longer
serve it, while every control plane signal an operator would check still
said the route was healthy.

This is issue #367's teardown fix in reverse. That fix made rule deletion
withdraw every advertisement a rule caused, regardless of which node
created it, discovered by listing on a label rather than reconstructing
names from the namespace's current gateway-node membership -- a node that
was registered when the rule was created and has since left would
otherwise never be found. The same blind spot existed here in the other
direction: nothing withdrew every advertisement a node caused when that
node left, including advertisements for rules that had themselves already
been deleted.

Added withdrawNodeAdvertisements, which lists BGPAdvertisements in the
namespace and deletes the ones name-qualified for the departing node --
its self-address advertisement and every "<rule>-<node>-v4"/"-v6" it
created. It's wired into the NotFound branch of Reconcile (the path that
actually runs in production, since NetworkGateway carries no finalizer,
so the object is already gone by the time any process observes the
deletion) keyed on the departed node's own name from the request, since
the node whose advertisements need withdrawing is usually the one whose
own process is already gone. It's also wired into the DeletionTimestamp
branch for defense in depth, ordered before Engine.Stop so there's never
a window where forwarding is gone but the route is still advertised.

Fixes #406

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@privateip
privateip requested a review from a team as a code owner August 16, 2026 16:38
@privateip
privateip merged commit f1c2605 into main Aug 16, 2026
11 checks passed
@privateip
privateip deleted the fix/issue-406 branch August 16, 2026 16:55
@jacobsmith928
jacobsmith928 removed their request for review August 16, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An advertisement outlives the gateway node that created it

2 participants