Conversation
During a rolling restart, the replacement container's ADD takes the veth pair over from a still-terminating predecessor under the same deterministic names. If that ADD then failed, rollback deleted the pair: the link now carried the new owner's stamp, so the ownership guard in Delete approved the teardown. A predecessor's pod could still be shown as attached with no interface, and nothing retried, because from CNI's point of view ADD and DEL both succeeded. The DEL half of this race was already fixed; an ADD still removes whatever holds the attachment. This closes the ADD half by making rollback never delete a pair it did not create. Add now reports whether it created the pair or took one over, and in the takeover case who owned it before, and a failed ADD's rollback hands a taken-over pair back to that owner instead of deleting it, so the live predecessor's own DEL reclaims it as usual. Key changes: - Add returns an AddResult carrying Adopted and the prior owner's alias - RestoreOwner re-stamps that alias on a taken-over pair, a no-op when the veth is already gone - The resource tracker remembers how the veth step resolved and branches rollback on it: created pairs are deleted, taken-over pairs are handed back Verification: lint, unit tests, the root-gated kernel tests, and the Kind cluster e2e all pass. Two new root-gated tests reproduce the takeover-then-rollback scenario and pin the restore behavior. Fixes #544 Co-Authored-By: Claude Code <noreply@anthropic.com>
ecv
previously approved these changes
Sep 16, 2026
The new root-gated veth tests (TestAddAdoptRollbackDoesNotDeletePriorOwnersVeth, TestRestoreOwnerNoOpWhenLinkGone) create a real kernel VRF/veth under the same "abc"/"def" identifiers internal/cni's TestCmdCheckValidConfigMissingResources asserts are absent. The unittest-root run executes all root-gated package binaries concurrently against the same host kernel, so the veth tests' VRF/veth pair could race that CHECK test into spuriously passing (and a veth Delete could race cnibgp's own "abc"/"def" device). Give the veth tests distinct identifiers so they no longer create state that collides with either suite. Co-Authored-By: Claude Code <noreply@anthropic.com>
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
During a rolling restart, a replacement container's ADD takes the veth pair over from its still-terminating predecessor; if that ADD then failed, rollback deleted the pair and left the predecessor's live pod with no interface. A failed ADD now hands a taken-over pair back to its prior owner instead of deleting it, so the live pod's own DEL reclaims it.
Test plan
Fixes #544
🤖 Generated with Claude Code