IPAM: try to reclaim empty IPAM blocks if pool is empty#11149
Merged
Conversation
Fixes a corner case for special-purpose block-size-/32 pools where all the blocks are "stranded" on nodes that don't need them.
Add timestamp on claim and avoid reclaiming a block that's less than 1min old.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a mechanism to reclaim empty IPAM blocks from other nodes when a pool is full, specifically targeting corner cases in special-purpose block-size-/32 pools where blocks become "stranded" on nodes that don't need them.
Key changes:
- Adds
AffinityClaimTimefield to IPAM blocks to track when affinity was claimed - Implements block reclamation logic that attempts to free empty blocks from other nodes when no free blocks are available
- Updates block release logic to clear the claim time when affinity is removed
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Multiple CRD manifests | Add affinityClaimTime field to IPAM block schema definitions |
libcalico-go/lib/backend/model/block.go |
Add AffinityClaimTime field to AllocationBlock struct |
libcalico-go/lib/apis/v3/ipam_block.go |
Add AffinityClaimTime field to IPAMBlockSpec |
libcalico-go/lib/ipam/ipam_block_reader_writer.go |
Implement block reclamation logic and update affinity release methods |
libcalico-go/lib/ipam/ipam_block.go |
Add helper method to extract affinity claim time |
libcalico-go/lib/ipam/ipam.go |
Update all calls to releaseBlockAffinity with new signature |
| Test files | Add comprehensive tests for block reclamation functionality |
Member
Author
|
Seeing failures in kube-controllers. Pushed some extra diags to see if it's anything to do with my change. |
73745d4 to
c8faa51
Compare
Member
Author
|
Passed on a rerun, I moved the extra diags to #11184, which is now merged. |
caseydavenport
approved these changes
Oct 20, 2025
fasaxc
added a commit
to fasaxc/docs
that referenced
this pull request
Oct 24, 2025
- /31 pools rely on IP borrowing, which is a global setting that may be disabled for other reasons. - As of projectcalico/calico#11149 the IPAM logic can reclaim /32 blocks from other nodes once they are empty avoiding problems with blocks getting stranded on the wrong node.
5 tasks
ctauchen
pushed a commit
to tigera/docs
that referenced
this pull request
Oct 29, 2025
- /31 pools rely on IP borrowing, which is a global setting that may be disabled for other reasons. - As of projectcalico/calico#11149 the IPAM logic can reclaim /32 blocks from other nodes once they are empty avoiding problems with blocks getting stranded on the wrong node.
sabags
pushed a commit
to sabags/calico
that referenced
this pull request
Dec 1, 2025
…o#11149) * IPAM: try to reclaim empty IPAM blocks if pool is empty Fixes a corner case for special-purpose block-size-/32 pools where all the blocks are "stranded" on nodes that don't need them. * Avoid reclaiming just-claimed blocks. Add timestamp on claim and avoid reclaiming a block that's less than 1min old.
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.
Description
Fixes a corner case for special-purpose block-size-/32 pools where all the blocks are "stranded" on nodes that don't need them.
Related issues/PRs
CORE-11223
Todos
Release Note
Reminder for the reviewer
Make sure that this PR has the correct labels and milestone set.
Every PR needs one
docs-*label.docs-pr-required: This change requires a change to the documentation that has not been completed yet.docs-completed: This change has all necessary documentation completed.docs-not-required: This change has no user-facing impact and requires no docs.Every PR needs one
release-note-*label.release-note-required: This PR has user-facing changes. Most PRs should have this label.release-note-not-required: This PR has no user-facing changes.Other optional labels:
cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.