ipam: Fix revert logic in reuseIPNets causing v4 CIDR duplication#44832
Merged
christarazi merged 1 commit intocilium:mainfrom Mar 18, 2026
Merged
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
4a52a5e to
904baeb
Compare
904baeb to
4ee3c37
Compare
Member
Author
|
/test |
|
/test Edit: #44407 |
tklauser
approved these changes
Mar 17, 2026
Member
tklauser
left a comment
There was a problem hiding this comment.
Looks good to me. One non-blocking question/suggestion inline.
4ee3c37 to
0b4e11e
Compare
When reuseIPNets processes a node with a pre-existing duplicate v6 CIDR, the v6 allocation fails with ErrCIDRAllocated. The revertStack.Revert() then releases the successfully-occupied v4 CIDR as well. Because the updated node object is never synced to the internal state but its CiliumNode spec still references the v4 CIDR, allocateNext can hand the same v4 CIDR to another node. The fix is to handle ErrCIDRAllocated per IP family. That means: * Keeping the successful family's allocation * Adding the node to n.nodes with partial CIDRs * Return the error so allocateNode can report it in the CiliumNode status Also make upsertLocked() detect spec changes so k8s can be updated instead of only updating the status only. Co-authored-by: André Martins <andre@cilium.io> Signed-off-by: Chris Tarazi <chris@isovalent.com>
0b4e11e to
a76c3b5
Compare
Member
Author
|
/test |
1 similar comment
|
/test |
This was referenced Mar 18, 2026
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.
When reuseIPNets processes a node with a pre-existing duplicate v6 CIDR,
the v6 allocation fails with ErrCIDRAllocated. The revertStack.Revert()
then releases the successfully-occupied v4 CIDR as well. Because the
updated node object is never synced to the internal state but its
CiliumNode spec still references the v4 CIDR, allocateNext can hand the
same v4 CIDR to another node.
The fix is to handle ErrCIDRAllocated per IP family. That means:
status
Also make upsertLocked() detect spec changes so k8s can be updated
instead of only updating the status only.