Repository navigation
fix: Withdraw a load balancer rule's route after the rule is deleted - #766
Conversation
292bd14 to
9ed8199
Compare
A gateway node working from a stale cache could create a BGPAdvertisement for a NetworkRule after NetworkRuleReconciler.reconcileDelete had listed the rule's advertisements, so the finalizer came off with that route still advertised. Since #758 the advertisement carries an owner reference to the rule and Kubernetes garbage collection eventually deletes it, but until then the fabric keeps sending VIP traffic to a node that has already unloaded the rule. Two windows close here. reconcileDelete still deletes what its cache sees, then lists the rule's advertisements again through the manager's uncached API reader; any found there are deleted and the rule is requeued after 1s, keeping the finalizer until a pass finds none. On the creating side, NetworkGatewayReconciler now runs sweepOrphanedAdvertisements on every pass: it lists this node's own advertisements by gateway-node label and deletes each one whose rule is missing from the pass's rule list and returns NotFound from the uncached reader. A rule the cache has not caught up with keeps its route. The sweep runs on the same pass that unloads the rule from the datapath, so a node that created a late advertisement withdraws it as soon as its cache drops the rule. The owner reference stays as the last resort. Both reconcilers take a required APIReader, wired to mgr.GetAPIReader() in galactic-gateway. A sweep failure is returned for retry and does not change the gateway's Ready condition. ARCHITECTURE-GATEWAY.md describes both changes. Fixes #763 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
9ed8199 to
573ad37
Compare
|
pr-rereviewer VERDICT: merge. Rebase pass shows no breakage; tests pass at new head. Applied findings: Rewrote PR body to replace NOTE callout with one plain sentence about building on #765 (finding 1), and amended the commit subject to "fix: Withdraw a load balancer rule's route after the rule is deleted" to match the PR title (finding 2). Both committed. pr-rereviewer ran: git log --show-signature; git range-diff; go build ./...; go vet ./internal/controller/ ./cmd/galactic-gateway/; go test ./internal/controller/ All CI checks passed: Build, Lint, Unit Tests, E2E Tests, and publish workflows all green. Merge method: merge (the only method the main ruleset allows). Auto-merge enabled and waits for approvals, which the review ruleset requires (1 approving review plus code owner review plus last-push approval; dismiss stale reviews on push). Note: Open PRs #761 and #738 also edit docs/agents/ARCHITECTURE-GATEWAY.md in different sections, so whichever merges second will need a rebase. |
Summary
A gateway node could keep advertising a load balancer rule's address for a few seconds after the rule was deleted, while no node served it, because its cache had not yet seen the deletion.
Teardown now checks the API server directly before it releases the rule, and deletes and rechecks any route its cache missed.
Each gateway node also withdraws its own routes for rules that no longer exist, on the same pass that unloads the rule, after the API server confirms the rule is gone.
Builds on #765, and the new cleanup works with its renamed routes.
Test plan
Fixes #763
🤖 Generated with Claude Code