Skip to content

Pass IPAM options when creating networks - #13936

Open
ousamabenyounes wants to merge 2 commits into
docker:mainfrom
ousamabenyounes:fix/issue-13785
Open

Pass IPAM options when creating networks#13936
ousamabenyounes wants to merge 2 commits into
docker:mainfrom
ousamabenyounes:fix/issue-13785

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Jul 11, 2026

Copy link
Copy Markdown

Summary

  • Pass Compose networks.*.ipam.options through to Docker network creation.
  • Add regression coverage for IPAM options without an IPAM driver or pool config.

Fixes #13785

Test verification (RED -> GREEN)

  • Baseline: make test initially reported DONE 497 tests, 2 skipped, 1 failure; the pre-existing failure was pkg/watch TestGitBranchSwitch.
  • RED: with only pkg/compose/create.go reverted, TestExecutePlanCreateNetworkWithIPAMOptions failed because opts.IPAM was nil instead of containing Options: {"ipam-option": "enabled"}.
  • GREEN: go test ./pkg/compose -run TestExecutePlanCreateNetworkWithIPAMOptions -count=1 -v passed.

Full local suite

  • Command: make test
  • Result: passed with DONE 499 tests, 2 skipped after rebasing on latest main.

@ousamabenyounes
ousamabenyounes requested review from a team as code owners July 11, 2026 08:23

@glours glours 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.

A few changes to improve readability and avoid confusion between the two IPAM definition blocks.

Comment thread pkg/compose/create.go Outdated
Comment thread pkg/compose/executor_test.go
@ousamabenyounes

ousamabenyounes commented Jul 16, 2026

Copy link
Copy Markdown
Author

Addressed the review feedback in 7d1e1078e:

  • built the IPAM object once in resolveOrCreateNetwork, including driver, config, and options, and removed the redundant second block
  • made the executor network test constants shared across the sibling tests
  • changed the IPAM option assertion values to ipam-option=enabled so they no longer collide with the project name

Rebased on latest docker:main and reran:

  • go test ./pkg/compose -run 'TestExecutePlan(Empty|CreateNetwork|CreateNetworkWithIPAMOptions)$' -count=1
  • make test -> DONE 499 tests, 2 skipped

@ousamabenyounes

Copy link
Copy Markdown
Author

Rebased on current main and addressed the review feedback by keeping IPAM construction in one place and using distinct test values.

Local validation:

  • go test ./pkg/compose -run "TestExecutePlan(Empty|CreateNetwork|CreateNetworkWithIPAMOptions)$" -count=1 -v
  • make lint

@ousamabenyounes

Copy link
Copy Markdown
Author

The failing check is e2e (standalone, oldstable) — it failed on the "Test standalone mode" step (exit code 2) with no test-level failure reported, while the plugin e2e variant passed on the same commit. This PR only touches createNetwork and its unit test (no e2e), so the failure looks unrelated to the change.

Locally against current main the package builds, go vet is clean, and go test ./pkg/compose/... passes — including TestExecutePlanCreateNetworkWithIPAMOptions.

Could a maintainer re-run the flaky e2e (standalone, oldstable) job? Happy to rebase on main if you'd prefer — thanks!

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
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