Skip to content

fix(network): pass IPAM options when creating networks - #14094

Merged
ndeloof merged 1 commit into
docker:mainfrom
glours:fix/ipam-options
Aug 20, 2026
Merged

fix(network): pass IPAM options when creating networks#14094
ndeloof merged 1 commit into
docker:mainfrom
glours:fix/ipam-options

Conversation

@glours

@glours glours commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What I did
createNetwork built the IPAM object in two separate blocks; the second silently overwrote createOpts.IPAM with a fresh empty struct and never forwarded n.Ipam.Options to the daemon.
Consolidate into a single block covering driver, config pool, and options.

Related issue
Fixes #13785
Supersedes #13936

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

@glours
glours requested review from a team as code owners August 19, 2026 15:36
@glours
glours requested a review from ndeloof August 19, 2026 15:36
@glours glours self-assigned this Aug 19, 2026

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

The consolidation of the IPAM creation block is correct and complete. The original bug — where a second block silently overwrote createOpts.IPAM with a fresh empty struct, discarding any Options — is properly fixed by merging everything into a single block guarded by n.Ipam.Driver != "" || len(n.Ipam.Config) > 0 || len(n.Ipam.Options) > 0. Iterating a nil n.Ipam.Config slice is a Go no-op, and passing nil for createOpts.IPAM when no IPAM fields are set is valid. The new test TestExecutePlanCreateNetworkWithIPAMOptions directly exercises the previously-broken code path and uses assert.DeepEqual to confirm the daemon receives the correct options.

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

createNetwork built the IPAM object in two separate blocks; the second
silently overwrote createOpts.IPAM with a fresh empty struct and never
forwarded n.Ipam.Options to the daemon. Consolidate into a single block
covering driver, config pool, and options.

Fixes docker#13785
Supersedes docker#13936

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
ndeloof
ndeloof previously approved these changes Aug 20, 2026
@ndeloof
ndeloof enabled auto-merge (rebase) August 20, 2026 10:26
@ndeloof
ndeloof merged commit 9e4a3c7 into docker:main Aug 20, 2026
46 checks passed
@ndeloof
ndeloof deleted the fix/ipam-options branch August 20, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Network's IPAM options not working

3 participants