Add support for maximum replicas per node without stack#1612
Add support for maximum replicas per node without stack#1612thaJeztah merged 1 commit intodocker:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1612 +/- ##
==========================================
+ Coverage 56.05% 56.14% +0.08%
==========================================
Files 306 306
Lines 20981 20980 -1
==========================================
+ Hits 11761 11779 +18
+ Misses 8371 8347 -24
- Partials 849 854 +5 |
|
@thaJeztah FYI. I moved non-stack version to this PR as it is already fully working and it easier to debug stack version when there is less stuff. Can you give first review? I assume that at least some kind of tests are wanted on but which kind of? Logic is tested on swarmkit and API on Moby. |
|
@thaJeztah reminder of this one. I really would like get feedback so I can finalize it. |
|
@vdemeester @thaJeztah PTAL |
cpuguy83
left a comment
There was a problem hiding this comment.
Looks good but could use some unit tests.
|
Ah, whoops, thought I reviewed; yes, changes look good, but if you can add a unit test, that'd be great |
4a9cbcd to
79b5119
Compare
silvin-lubecki
left a comment
There was a problem hiding this comment.
Small nit but LGTM otherwise, thank you @olljanat 👍 !
79b5119 to
d103bd4
Compare
|
@silvin-lubecki corrected that one and rebased to one commit. |
thaJeztah
left a comment
There was a problem hiding this comment.
apologies for the delay; found some minor issues, and a missing "version" annotation 😊
|
Please sign your commits following these rules: $ git clone -b "replicas-max-per-node-cli" git@github.com:olljanat/cli.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842358453696
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: Olli Janatuinen <olli.janatuinen@gmail.com>
bb7be90 to
f7f4d3b
Compare
|
@thaJeztah included changes you suggested and rebased to one commit. |
|
Gave this a spin, and all looks good 😄 We could add some more tests based on the scenarios below, but I'm ok to keep that for a follow-up. Create a service with max 2 replicas: docker service create --replicas=2 --replicas-max-per-node=2 --name test nginx:alpine
docker service inspect --format '{{.Spec.TaskTemplate.Placement.MaxReplicas}}' test
2Update the service (max replicas should keep its value) - this works ok; docker service update --replicas=1 test
docker service inspect --format '{{.Spec.TaskTemplate.Placement.MaxReplicas}}' test
2Update the max replicas to 1 docker service update --replicas-max-per-node=1 test
docker service inspect --format '{{.Spec.TaskTemplate.Placement.MaxReplicas}}' test
1And reset to 0: docker service update --replicas-max-per-node=0 test
docker service inspect --format '{{.Spec.TaskTemplate.Placement.MaxReplicas}}' test
0 |
Hi! I would like to link
Hi everyone! I have a tricky issue here. I posted it on Docker Swarm (classicswarm repo -> docker-archive/classicswarm#2979), but I think this is the right place. Please, read that issue because it is related with this update and it is not working very well when it is needed to update services already running because the "no suitable node" issue, so, is ok, it is necessary, but the implementation blocks updates on docker swarm. Please read the issue. Thanks, |
- What I did
Added support for maximum replicas per node
Third step to be able solve:
- How I did it
Added new switch --replicas-max-per-node switch to docker service
- How to verify it
Create two services and specify
--replicas-max-per-nodeone of them:See difference on command outputs:
- Description for the changelog