Skip to content

fix(attach): Stop egress dropping while a fabric uplink reinstalls routes - #1572

Merged
privateip merged 3 commits into
mainfrom
fix/issue-1570
Dec 2, 2026
Merged

privateip merged 3 commits into
mainfrom
fix/issue-1570

Conversation

@privateip

@privateip privateip commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1570.

After the node's CNI agent restarts, tenant egress no longer drops for 1 to 2 seconds while the fabric uplink's routes are reinstalled. The agent keeps that uplink attached during the reinstall, but the egress gateway reachability check rejected it, so every gateway looked dead and each gateway group lost all its members. The check now accepts any uplink the datapath keeps attached.

Risk

An uplink that really stops carrying fabric routes stays usable for egress for up to 60 seconds. That is how long the datapath already keeps forwarding through it. A gateway whose routes are withdrawn is still marked dead at once.

This PR and #598 edit adjacent hunks of the same attach file, so whichever merges second needs a rebase.

Verification

  • Three new tests fail without the fix and pass with it.
  • The affected packages pass race-enabled unit tests and lint on the final commit.
  • The full CI suite, including the Kind end-to-end test, passed on the commit before the review follow-ups. Those added one log line, one code comment and one doc sentence.
  • The privileged kernel tests were not run, because no privileged environment was available.

When the underlay routing daemon reinstalls the BGP routes on a fabric
uplink, the uplink drops out of ResolveInterfaces for a moment. The
watch loop keeps it attached through its 60 s hold-down, and the
datapath goes on forwarding through it. UplinkIndexes ignored the
hold-down and re-resolved from scratch, so every egress shard SID
routed over that uplink failed with "resolves out link N, which the
datapath is not attached to". The egress sweep then published every
shard group with no alive member, and tenant egress dropped as
group_empty until the next sweep.

The watch loop now records the set it keeps attached, held interfaces
included, and clears it when it exits. UplinkIndexes accepts that set
on top of a fresh resolution, and falls back to it when resolution
fails. A process with no watch loop, such as the CNI plugin binary,
behaves as before.

Fixing the uplink set, rather than keeping a shard's last next hop in
the shard group, keeps every route check in step with the links the
datapath forwards on. It still rejects a shard whose locator is gone,
since rejectDefaultRoute catches a SID matched only by a default
route.

Fixes #1570
@privateip
privateip requested a review from a team as a code owner December 2, 2026 00:53
@privateip privateip self-assigned this Dec 2, 2026
Keep what watchedUplinks holds and the one constraint that matters,
a single Watch loop per process.
@privateip privateip changed the title fix(attach): Keep a held uplink usable for egress shards fix(attach): Stop egress dropping while a fabric uplink reinstalls routes Dec 2, 2026
@privateip
privateip enabled auto-merge December 2, 2026 01:16
@privateip

Copy link
Copy Markdown
Contributor Author

Second-pass review on head 40609d7 found both reviewers in agreement.

pr-rereviewer: "VERDICT: merge. All four applied findings confirmed at head; comment-only fix diff with no regression. Merge waits on green CI on this head." It ran: gh pr view; git diff 0924e31..40609d7; git log --show-signature; gofmt -l internal/plumbing/ebpf/attach/; go build ./internal/plumbing/ebpf/attach/.

pr-conventions-reviewer: "VERDICT: merge. No reach or ownership concern; nothing blocks." It ran: gh pr view; git diff base...head; gh pr list; gh pr diff 1571; gh pr diff 598; read CLAUDE.md and the pr-conventions and commit-conventions skills.

The first pass on 0924e31 also returned merge from both reviewers, and the adversarial reviewer's go test -race run on internal/plumbing/ebpf/attach passed. Four findings were applied in commit 40609d7: the PR title, the opening body sentence, the note about the overlapping #598 change, and a shortened comment in the uplink watcher. The fix diff is comment-only. Remaining nits were left as is: squashing the trim commit would need a force-push, and the Verification list is approximate.

CI on the head is green: every check passed except two publish jobs that were skipped by design.

Auto-merge is enabled with the merge method, the only one the base branch ruleset allows. The ruleset requires one approving review including a code owner, and a new push dismisses stale approvals, so the PR waits for a human approval before it merges.

@privateip
privateip requested a review from scotwells December 2, 2026 01:31

@scotwells scotwells left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the last detectable uplink loses its routes, the watcher returns on ErrNoUplinkRoute before it expires the hold. A shard route that still points to that link can keep receiving traffic past 60 seconds even though the uplink can’t deliver it. Please expire held links in this case too, and add a test where the last uplink stays missing beyond the hold.

When the last uplink loses its routes, ResolveInterfaces fails with
ErrNoUplinkRoute. Watch treated that like any transient resolution
error and skipped the pass before holdMissing ran, so no hold-down
timer was armed and the held interfaces stayed attached for good.
Since UplinkIndexes now accepts the attached set, an egress shard
routed over such a link also stayed alive past the 60 s hold-down,
though the link could no longer deliver.

Watch now reconciles ErrNoUplinkRoute as an empty set. Every attached
interface goes through the hold-down and is detached when it ends,
which clears it from the set UplinkIndexes accepts. Other resolution
errors still keep the previous attachment.
@privateip

Copy link
Copy Markdown
Contributor Author

Thanks, confirmed and fixed in 17f2a05.

Watch skipped every pass that failed with ErrNoUplinkRoute before holdMissing ran, so no hold-down timer was ever armed and the held set never expired. It now reconciles that error as an empty set. Every attached interface is held for the hold-down, then detached and dropped from the set UplinkIndexes accepts. Other resolution errors still keep the previous attachment.

TestWatch_LastUplinkMissingExpiresTheHold covers it. It checks that the last uplink stays missing past the hold-down, is accepted while held, and afterwards is detached and rejected. On the previous head it fails because the loop never re-evaluates.

@scotwells scotwells left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The watcher now expires the hold when the last uplink loses its routes. The regression test covers both forwarding during the hold and removal after expiry. This resolves my change request.

@privateip
privateip merged commit 18ea2b4 into main Dec 2, 2026
28 checks passed
@privateip
privateip deleted the fix/issue-1570 branch December 2, 2026 03:05
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.

Tenant egress drops for about a minute after galactic-cni restarts

2 participants