Repository navigation
fix(attach): Stop egress dropping while a fabric uplink reinstalls routes - #1572
Conversation
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
Keep what watchedUplinks holds and the one constraint that matters, a single Watch loop per process.
|
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. |
scotwells
left a comment
There was a problem hiding this comment.
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.
|
Thanks, confirmed and fixed in 17f2a05.
|
scotwells
left a comment
There was a problem hiding this comment.
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.
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