-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Added arguments to create a swarm with a custom address pool and subnet size. #2201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added arguments to create a swarm with a custom address pool and subnet size. #2201
Conversation
…net size. Signed-off-by: Barry Shapira <[email protected]>
|
Adding the arguments to swarm init was relatively straightforward. I do wonder how the maintainers will feel about adding these arguments at all: other parts of the docker-py swarm API rely on a docker engine API version of 1.24, whereas these features are from a much more recent docker engine API of 1.39. If any maintainers have ideas on how best to handle modernization of the swarm part of this repo I would be happy to help round out the codebase and truly "let you do anything the docker command does". |
|
Thanks for submitting a PR @originalgremlin ! FWIW, the library already has a fairly established way to handle parameters added in newer versions of the API. see here or here for example. Please make sure to adopt the same idiom for this PR so we can move forward! |
Also corrected a documentation error: the default API version from constants is currently 1.35, not 1.30 as was sometimes listed. Signed-off-by: Barry Shapira <[email protected]>
|
@shin- That makes sense. Thanks for pointing out the examples for how such things are handled. Code updated and pushed. Has been tested a fair amount in my local environment. Did my best to stick with the project style though you may well have suggestions for things that I missed. |
|
Please sign your commits following these rules: $ git clone -b "2200-swarm-default-addr-pool" [email protected]:originalgremlin/docker-py.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354056040
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -fAmending updates the existing PR. You DO NOT need to open a new one. |
Signed-off-by: Barry Shapira <[email protected]>
d74d652 to
6e21b83
Compare
The integration tests require restarting the swarm once for each test. I had done so manually with self.init_swarm(force_new_cluster=True) but that wasn't resetting the swarm state correctly. The usual test teardown procedure cleans up correctly. Signed-off-by: Barry Shapira <[email protected]>
|
@shin- Should be ready to go now. All tests pass and all protocol followed to the best of my ability. Let me know if there's any other polishing I should do. |
|
@shin- Squeaky wheel ping. Anything missing or needing improvement in order to get this PR merged? |
chris-crone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @originalgremlin! Just a couple of minor comments.
|
|
||
| @utils.minimum_version('1.24') | ||
| def init_swarm(self, advertise_addr=None, listen_addr='0.0.0.0:2377', | ||
| default_addr_pool=None, subnet_size=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add new parameters at the end of the list so that callers of init_swarm that use ordered (i.e.: unnamed) parameters continue to work as expected.
e.g.: An existing function could call:
s.init_swarm('192.168.0.1', '0.0.0.0:2377', True)Which would now break.
| get_unlock_key.__doc__ = APIClient.get_unlock_key.__doc__ | ||
|
|
||
| def init(self, advertise_addr=None, listen_addr='0.0.0.0:2377', | ||
| default_addr_pool=None, subnet_size=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here for parameters.
| is used. Default: '0.0.0.0:2377' | ||
| default_addr_pool (list of strings): Default Address Pool specifies | ||
| default subnet pools for global scope networks. Each pool | ||
| should be specified as a CIDR block, like '10.0.0.0/16'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Might be good to use the default as the example.
Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]>
Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]>
Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]>
Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]>
Following docker#2201 (review) Co-authored-by: hannseman <[email protected]> Co-authored-by: bluikko Signed-off-by: Hannes Ljungberg <[email protected]>
Co-authored-by: hannseman <[email protected]> Co-authored-by: bluikko <[email protected]> Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]>
Co-authored-by: hannseman <[email protected]> Co-authored-by: bluikko <[email protected]> Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]>
Co-authored-by: hannseman <[email protected]> Co-authored-by: bluikko <[email protected]> Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]>
Co-authored-by: hannseman <[email protected]> Co-authored-by: bluikko <[email protected]> Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]>
Co-authored-by: Hannes Ljungberg <[email protected]> Co-authored-by: bluikko <[email protected]> Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]>
Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]> Co-authored-by: Hannes Ljungberg <[email protected]> Co-authored-by: bluikko <[email protected]>
Following docker#2201 (review) Signed-off-by: Hannes Ljungberg <[email protected]> Co-authored-by: Hannes Ljungberg <[email protected]> Co-authored-by: bluikko <[email protected]>
Signed-off-by: Barry Shapira [email protected]