Skip to content

Support placement preferences in stack deployment#32743

Closed
denverdino wants to merge 4 commits intomoby:masterfrom
AliyunContainerService:preference_support
Closed

Support placement preferences in stack deployment#32743
denverdino wants to merge 4 commits intomoby:masterfrom
AliyunContainerService:preference_support

Conversation

@denverdino
Copy link
Contributor

Fix #32584 Support placement preferences in stack deployment

Signed-off-by: Li Yi denverdino@gmail.com

- What I did
Following the compose definition in moby/swarmkit#1512 , I support the placement preferences in docker stack deploy

- How I did it
Add the placement preferences in docker compose scheme

- How to verify it

Create a docker swarm with 3 nodes, and then add the "az" label to the nodes

docker node update --label-add az=az1 node1
docker node update --label-add az=az1 node2
docker node update --label-add az=az2 node3

Create docker-compose.yaml as following

version: "3.3"
services:
  nginx:
    image: nginx
    deploy:
      mode: replicated
      replicas: 2
      placement:
        preferences:
          - spread: node.labels.az

docker stack deploy -c docker-compose.yaml test

The nginx container will be spread on the nodes with different az

- A picture of a cute animal (not mandatory but encouraged)

Image of Panda

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new version of the schema is missing the consistency field from 3.2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting is off here, are you using tabs? This file uses spaces

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test would be more appropriate as a test in cli/compose/loader/. There is a TestFull that you can add to

The tests in this package are for the schema loading and validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test case added. Thanks for comments

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Apr 26, 2017
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Apr 26, 2017
@dnephin
Copy link
Member

dnephin commented Apr 26, 2017

Design LGTM

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya this is necessary as we expand full example to include the new fields

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vdemeester
Copy link
Member

!rebuild powerpc #33041

@vdemeester
Copy link
Member

Moving to docs-review, cc @thaJeztah

denverdino and others added 4 commits May 5, 2017 23:04
Support preferences for placement

Change-Id: I90bf1499ba413cfa1359a5a609f48e93f8d2722b
Signed-off-by: Li Yi <denverdino@gmail.com>
Change-Id: Ib9bbf0dbc39252ec7ba0adf03d656e6ccc598005
Signed-off-by: Li Yi <denverdino@gmail.com>
Change-Id: I456a294d50015da1d31733260f19b168a98063fb
Signed-off-by: Li Yi <denverdino@gmail.com>
Change-Id: I14ab320af46e8c386fe94ece728ee1166ba02d71
Signed-off-by: Li Yi <denverdino@gmail.com>
@ColinHebert
Copy link
Contributor

FYI, due to #32694, this PR should be closed and opened again in https://github.com/docker/cli

It will require the changes in docker/cli#32 to be ported as is.

@denverdino
Copy link
Contributor Author

thx for notification

@denverdino denverdino closed this May 6, 2017
denverdino added a commit to AliyunContainerService/cli that referenced this pull request May 6, 2017
Move of moby/moby#32743

Signed-off-by: Li Yi <denverdino@gmail.com>
@denverdino
Copy link
Contributor Author

Open a new PR docker/cli#35

denverdino added a commit to AliyunContainerService/cli that referenced this pull request May 8, 2017
Move of moby/moby#32743

Signed-off-by: Li Yi <denverdino@gmail.com>
denverdino added a commit to AliyunContainerService/cli that referenced this pull request May 8, 2017
Move of moby/moby#32743

Signed-off-by: Li Yi <denverdino@gmail.com>
andrewhsu pushed a commit to docker-archive/docker-ce that referenced this pull request May 19, 2017
Move of moby/moby#32743

Signed-off-by: Li Yi <denverdino@gmail.com>
Upstream-commit: b3459936dba6f0fb5b23b43cd5e168186ad87f35
Component: cli
@BSWANG BSWANG deleted the preference_support branch July 19, 2017 07:46
@BSWANG BSWANG restored the preference_support branch July 19, 2017 07:46
@BSWANG BSWANG deleted the preference_support branch July 19, 2017 07:46
@BSWANG BSWANG restored the preference_support branch July 19, 2017 07:46
ndeloof pushed a commit to compose-spec/compose-go that referenced this pull request Dec 12, 2019
Move of moby/moby#32743

Signed-off-by: Li Yi <denverdino@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants