Global Default Address Pool feature support#37558
Conversation
Codecov Report
@@ Coverage Diff @@
## master #37558 +/- ##
=========================================
Coverage ? 36.12%
=========================================
Files ? 610
Lines ? 45064
Branches ? 0
=========================================
Hits ? 16280
Misses ? 26538
Partials ? 2246 |
7fb5924 to
c85336d
Compare
ca67176 to
13da5c1
Compare
|
Please sign your commits following these rules: $ git clone -b "master" [email protected]:selansen/moby.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -fAmending updates the existing PR. You DO NOT need to open a new one. |
890f88d to
d1be4ae
Compare
|
Below are the PRs, need to be picked up along with this PR. Libnetwork: moby/libnetwork#2241 CLI : docker/cli#1233 SwarmKit : moby/swarmkit#2714 |
|
Below failure doesn't look like related to my changes. AIL: docker_cli_swarm_test.go:1376: DockerSwarmSuite.TestSwarmClusterRotateUnlockKey |
2cf041f to
fef644c
Compare
|
Added extra integration test :) |
|
@thaJeztah , PTAL and let me know if you still have any comments. |
483cc86 to
2d7160c
Compare
api/swagger.yaml
Outdated
There was a problem hiding this comment.
This doesn't match the actual API, which uses an array of net.IPNet for DefaultAddrPool, and a separate SubnetSize field for the size.
api/swagger.yaml
Outdated
There was a problem hiding this comment.
Swagger describes the API specification, so should not mention "flag".
"subnet size" is a separate option; you can mention it in the description here, but the default should probably be described as part of the description for SubnetSize.
Would be good to have an example value in the swagger spec as well, so that it's clear how what format is expected.
daemon/cluster/convert/swarm.go
Outdated
There was a problem hiding this comment.
The change I proposed wouldn't change that logic; the only difference is that it would scope the b variable to the if (and it being a more idiomatic code-style); it's just a nit though, so not a blocker
api/types/swarm/swarm.go
Outdated
There was a problem hiding this comment.
Although I suggested to use IPNet for as internal type (mainly for the CLI-side); for the over-the-wire format for this is rather awkward; the string representation (without converting individual entries to a string when marshalling);
For example, the request now needs to look like;
{"DefaultAddrPool":[{"IP":"192.0.2.0","Mask":"////AA=="}]}Whereas individually encoding IPNet to a string would look like
{"DefaultAddrPool":["192.0.2.0/24"]}There was a problem hiding this comment.
Completely agree with @thaJeztah, we shouldn't leak implementation detail in our API and have our own type here (if we need something complex). Here it seems just a slice of string would work.
api/types/swarm/swarm.go
Outdated
There was a problem hiding this comment.
Completely agree with @thaJeztah, we shouldn't leak implementation detail in our API and have our own type here (if we need something complex). Here it seems just a slice of string would work.
daemon/cluster/convert/swarm.go
Outdated
There was a problem hiding this comment.
We are adding into slice only if b is not null.
Wrong, you're adding it to the slice only if err == nil, there is no check on b. I do agree with @thaJeztah and the proposed change 👼
There was a problem hiding this comment.
I don't think this is required… We should update the NewSwarm function instead, with a WithInitOption operation.
internal/test/daemon/swarm.go
Outdated
There was a problem hiding this comment.
Same as above, we could update StartAndSwarmInit to take *operationswith one forInitRequest`
func (d *Daemon) StartAndSwarmInit(t testingT, ops ...func(*swarm.InitRequest{})) {
initRequest := &swarm.InitRequest{}
for _, op := range ops { op(initRequest) }
// …
d.SwarmInit(t, *initRequest)
}|
@thaJeztah @vdemeester PTAL. Modified API param from IPNet to String slice. |
7887345 to
0e185a2
Compare
vendor.conf
Outdated
thaJeztah
left a comment
There was a problem hiding this comment.
Some minor issues in swagger.yml (and some suggestions for follow-ups), but otherwise looks good to me.
api/swagger.yaml
Outdated
There was a problem hiding this comment.
This should be "array" with "string" as type for the items, e.g. similar to
Lines 414 to 417 in 896d1b1
api/swagger.yaml
Outdated
There was a problem hiding this comment.
DefaultAddrPool is an array, so this should be something like;
DefaultAddrPool: ["10.10.0.0/16", "20.20.0.0/16"]
daemon/cluster/noderunner.go
Outdated
There was a problem hiding this comment.
Ideally, we'd fix the int / uint32 on swarmkit side as well before GA (for a follow-up before GA)
There was a problem hiding this comment.
yes. I am planning to refactor swarmkit code as Anshul wanted to move around code a bit
daemon/cluster/noderunner.go
Outdated
There was a problem hiding this comment.
Could be done in a follow-up, but; I see other validation steps are done in newNodeRunner(); we should consider moving those all to a single place, not partly here, and partly there. We can also return parsing errors there.
|
@selansen vendor check is failing; can you check? |
This feature allows user to specify list of subnets for global default address pool. User can configure subnet list using 'swarm init' command. Daemon passes the information to swarmkit. We validate the information in swarmkit, then store it in cluster object. when IPAM init is called, we pass subnet list to IPAM driver. Signed-off-by: selansen <[email protected]>
|
PowerPC failure is unrelated; #34988 |
|
windowsRS1 failure : this doesnt look related to my change |
This feature allows user to specify list of subnets for global
default address pool. User can configure subnet list using
'swarm init' command. Daemon passes the information to swarmkit.
We validate the information in swarmkit, then store it in cluster
object. when IPAM init is called, we pass subnet list to IPAM driver.
Signed-off-by: selansen [email protected]
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)