Repository navigation
fix: Reclaim stale taps whose host-only stamp names no owner - #1334
Merged
Merged
Conversation
A host-only tap stamped before d6a7731 carries an alias that records its ports and no owner. Its own DEL kept such a tap, since the stamp names no owner to match, and the stale tap reclaimer added in #1331 skipped it for the same reason. So the taps left behind by that DEL were never removed. The reclaimer now takes a host-only stamp with no owner as an ADD's stamp, and removes the tap as the empty owner, which tap.Delete already accepts for such an alias. Every other guard is unchanged: no attached or disabled queues, no BGPAdvertisement, no identified VPCAttachment, two confirming passes and the re-check under the VRF lock. An empty alias and a malformed host-only stamp are still kept. Unit tests cover removal of an owner-less host-only tap on the second pass, and keeping one that a VMM holds, a VPCAttachment carries or an advertisement names. The root test adds such a tap and shows the kernel removes it alongside the owned stale tap. Fixes #1330
Review asked that the reclaimer's comments describe the stamps it accepts rather than how owner-less host-only stamps came about, which the previous commit message records. The test comments and the CNI architecture bullet now name the stamp shape, a host-only stamp with no owner.
The stampedByADD docstring now reads as a sentence, the root test comment no longer leaves an orphaned line, and the GC sequence doc states that a host-only stamp counts whether or not it names an owner, without the history the earlier wording carried.
privateip
enabled auto-merge
November 3, 2026 16:27
Collaborator
Author
|
Two independent reviews ran on this PR, plus one second pass after the review fixes. All returned merge.
CI is green on the head. Auto-merge is on with the merge method, behind the required code owner approval. |
ecv
approved these changes
Nov 3, 2026
ecv
left a comment
Contributor
There was a problem hiding this comment.
Approve.
Widening the candidate test to a well-formed host-only stamp with no owner leaves every keep guard intact, and none is skipped for the owner-less case.
- Guards are shared:
detachedTenantTap(no fd on any queue), the advertisement prefix check, theVPCAttachmentidentity match and the two-pass confirmation all run on the same path for owner-less taps. The new keep-cases (VMM-held, liveVPCAttachment, advertisement-named, malformed stamp) cover each. - Mid-ADD:
tap.Addruns insidevrf.EnsureAndEnslave, so the tap's brief unstamped moment is under the same lock, and an empty alias is never a candidate. The removal re-reads the link under the VRF lock and compares the full candidate (ifindex and alias); an adopting ADD rewrites the alias, soagain != tkeeps the tap. - Deleting with the empty owner is safe:
tap.OwnedByaccepts it only whenAliasOwner(alias)is also empty, so a tap a new owner has claimed is left alone. - API reads are live, not cached: the client is
client.New(no informer cache). Any list error resets the pending set and removes nothing, and an empty set of identified attachments aborts the pass witherrNoIdentifiedAttachments. Read failure keeps the tap. - Owner-less stamps come from older builds whose ports-only alias recorded no owner, including an older build's ADD after a rollback; production
HostOnlyAliasalways passes the container ID. A live VM's tap stays safe through the guards above (VMM fd, an identifiedVPCAttachment, an advertisement), not through anything in the stamp, so only an orphan with none of them is reclaimed.
Follow-ups:
- A first-time deploy reclaims leftover owner-less taps from old builds on the second 5-minute tick. Check the
galactic_cni_stale_taps_reclaimed_totaljump in staging before the tag goes out. identifiedAttachmentstrusts that the node's client sees the sameVPCAttachmentset as the whole cluster. The non-empty guard only covers the all-missing case, so a partial view would still reclaim. Worth a note in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tenant taps stamped before host-only stamps recorded an owner still leak, because the stale tap reclaimer from #1331 only accepts a stamp that names an owner.
Those taps were kept by their own DEL for the same reason, so nothing removes them, and each one keeps a route and an unattributed traffic policy row.
The reclaimer now also accepts a host-only stamp with no owner. Every other guard stays in place, so a tap a VMM holds, or one a VPCAttachment or advertisement still names, is kept.
Test plan
Fixes #1330