Skip to content

ipam: test ECMP support#1248

Merged
squeed merged 1 commit intocontainernetworking:mainfrom
yushoyamaguchi:test-ipam-ecmp1
Apr 13, 2026
Merged

ipam: test ECMP support#1248
squeed merged 1 commit intocontainernetworking:mainfrom
yushoyamaguchi:test-ipam-ecmp1

Conversation

@yushoyamaguchi
Copy link
Copy Markdown
Contributor

When multiple routes entries share the same dst but list different gw values, they collectively enable ECMP (e.g. two default routes with distinct gateways).

      "routes": [
        { "dst": "0.0.0.0/0", "gw": "10.0.0.1" },
        { "dst": "0.0.0.0/0", "gw": "10.0.0.2" }
      ]

The implementation already handles this path—ConfigureIface programs both routes, and static IPAM returns them—so real traffic gets load-balanced across gateways today.
https://github.com/containernetworking/plugins/blob/v1.9.1/pkg/ipam/ipam_linux.go#L148
This commit adds explicit tests for this ECMP behavior.

The concrete contents of this commit is below.

  • add static IPAM spec proving multiple routes with the same dst keep distinct gateways
  • add ConfigureIface ECMP test that inspects netlink routes for both gateways

@yushoyamaguchi
Copy link
Copy Markdown
Contributor Author

After this PR is merged, I want to add ECMP document to https://github.com/containernetworking/cni.dev

@yushoyamaguchi
Copy link
Copy Markdown
Contributor Author

The result of test

yamaguchi@yamaguchi-cilium-dev:~/mship-oss/cni-plugins$ sudo env "PATH=$(go env GOPATH)/bin:/usr/local/go/bin:$PATH"     sh -c 'umask 0; PATH=$(pwd)/bin:$PATH go test -race ./pkg/ipam'
ok      github.com/containernetworking/plugins/pkg/ipam 1.130s
yamaguchi@yamaguchi-cilium-dev:~/mship-oss/cni-plugins$ go test ./plugins/ipam/static
ok      github.com/containernetworking/plugins/plugins/ipam/static      0.036s

- add static IPAM spec proving multiple routes with the same dst keep distinct GWs
- add ConfigureIface ECMP test that inspects netlink routes for both gateways

Signed-off-by: Yusho Yamaguchi <[email protected]>
@yushoyamaguchi
Copy link
Copy Markdown
Contributor Author

@squeed
Copy link
Copy Markdown
Member

squeed commented Apr 13, 2026

Very nice, thanks!

@squeed squeed merged commit c1069bd into containernetworking:main Apr 13, 2026
6 checks passed
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.

2 participants