Skip to content

fix(ipam): stop random allocation of excludeIps after IPPool reconcile - #7275

Open
zhangzujian wants to merge 6 commits into
kubeovn:masterfrom
zhangzujian:fix/ipam-exclude-ips-random-alloc
Open

fix(ipam): stop random allocation of excludeIps after IPPool reconcile#7275
zhangzujian wants to merge 6 commits into
kubeovn:masterfrom
zhangzujian:fix/ipam-exclude-ips-random-alloc

Conversation

@zhangzujian

@zhangzujian zhangzujian commented Aug 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Keep excludeIps out of the default pool free list when an IPPool is created or reconciled. Rebuilding V4Free/V6Free from Available previously reintroduced released reserved addresses.
  • Strip reserved addresses before random allocation, including the Released recycle path, so ordinary pods cannot receive excluded IPs.
  • Add regressions for the customer-style sequence (static use of an excluded IP, release, IPPool reconcile, default-pool random allocation) and for recycling reserved addresses from Released.
  • Verify that V6 exhaustion rolls back a newly allocated V4 address while preserving an existing V4 lease.

Static allocation from excludeIps remains allowed.

Test Plan

  • go test -count=1 ./pkg/ipam
  • go vet ./pkg/ipam

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working test automation tests labels Aug 20, 2026
@coveralls

coveralls commented Aug 20, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 32360410414

Coverage increased (+0.01%) to 32.765%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 12 of 12 lines across 1 file are fully covered (100%).
  • 2 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

2 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
pkg/ovs/ovn-nb-bfd.go 2 61.61%

Coverage Stats

Coverage Status
Relevant Lines: 64590
Covered Lines: 21163
Line Coverage: 32.77%
Coverage Strength: 0.38 hits per line

💛 - Coveralls

@zhangzujian

Copy link
Copy Markdown
Member Author

/test e2e core

@github-actions

Copy link
Copy Markdown
Contributor

Queued x86 E2E approval intent for current HEAD 7ab4cba.

@github-actions

Copy link
Copy Markdown
Contributor

Recorded x86 E2E approval for current HEAD 7ab4cba.

Random IPAM allocates from the in-memory free list without consulting
reserved addresses. Rebuilding the default pool from V4Available during
AddOrUpdateIPPool, or recycling V4Released when free is empty, can put
released excludeIps back into that free list. Strip reserved addresses
from both paths so ordinary pods cannot receive excluded IPs.

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
Put the exclude range at the front of the usable CIDR so a leaked reserved
address would be allocated first, and assert the default pool free list
does not contain it after IPPool reconcile. Collapse the duplicate
no-available branches on the reserved recycle path.

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
@zhangzujian
zhangzujian force-pushed the fix/ipam-exclude-ips-random-alloc branch from 72bffac to 7ab62ab Compare August 20, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files. test automation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants