api, daemon: report IPAM status for local-scope networks#50917
Merged
corhere merged 3 commits intomoby:masterfrom Sep 10, 2025
Merged
api, daemon: report IPAM status for local-scope networks#50917corhere merged 3 commits intomoby:masterfrom
corhere merged 3 commits intomoby:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds IPAM allocation status reporting for networks through API v1.52 and newer. This feature provides runtime statistics about IP address usage for local-scope networks to improve network management visibility.
Key changes:
- Implements IPAM status collection and reporting in the network inspect endpoint
- Creates iterator utility functions for chaining sequences
- Refactors uint128 implementation into reusable package
- Adds comprehensive integration tests
Reviewed Changes
Copilot reviewed 21 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/iterutil/iterutil.go |
Implements Chain and Chain2 iterator utility functions |
internal/iterutil/iterutil_test.go |
Adds comprehensive tests for iterator utility functions |
daemon/libnetwork/network.go |
Implements IPAMStatus method for network status collection |
daemon/libnetwork/ipams/defaultipam/allocator.go |
Adds PoolStatus method to default IPAM allocator |
daemon/libnetwork/ipams/defaultipam/address_space.go |
Implements allocation status tracking logic |
daemon/libnetwork/internal/uint128/uint128.go |
Refactored uint128 implementation with improved API |
daemon/libnetwork/ipbits/ipbits.go |
Updates to use new uint128 package |
api/types/network/* |
Defines new API types for IPAM status reporting |
integration/network/bridge/bridge_linux_test.go |
Comprehensive integration test for IPAM status feature |
daemon/server/router/network/network_routes.go |
Enables status collection for API v1.52+ |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Contributor
Author
|
I plan to port over the ipvlan and macvlan integration tests from #50450, either in this PR or a fast follow-up. I wanted to get this PR up for review early to give folks a chance to review the proposed API additions while I finish up. |
267558e to
e03bb0d
Compare
robmry
reviewed
Sep 9, 2025
cba85f7 to
f01d0f6
Compare
akerouanton
reviewed
Sep 10, 2025
Add utilities to concatenate multiple iterators of the same type into a single iterator. Signed-off-by: Cory Snider <csnider@mirantis.com>
The uint128 type is very convenient for manipulating 128 bit-wide quantities, as tends to come up in several contexts when working with IPv6. Move it into a libnetwork/internal/ package so it can be reused elsewhere within libnetwork. Signed-off-by: Cory Snider <csnider@mirantis.com>
On API v1.52 and newer, the GET /networks/{id} endpoint returns
statistics about the IPAM state for the subnets assigned to the network.
Signed-off-by: Cory Snider <csnider@mirantis.com>
f01d0f6 to
3f86797
Compare
robmry
approved these changes
Sep 10, 2025
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.
- What I did
On API v1.52 and newer, the
GET /networks/{id}endpoint returns statistics about the IPAM state for the subnets assigned to local-scope networks.- How I did it
By aggregating the AddrSet popcounts in the default IPAM allocator.
- How to verify it
New integration tests for the bridge, ipvlan and macvlan drivers.
- Human readable description for the release notes
- Inspecting networks with API v1.52 and newer provides statistics about IPAM allocations for the subnets assigned to the network.- A picture of a cute animal (not mandatory but encouraged)