Skip to content
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 support for swarm service isolation mode #34424

Merged
merged 1 commit into from
Nov 1, 2017

Conversation

simonferquel
Copy link
Contributor

@simonferquel simonferquel commented Aug 7, 2017

- What I did
Added isolation field on swarm service creation / updates to enable setting hyperv/process isolation per service on Windows
- How I did it
Updated swarmkit (PR with isolation in containerspec), added the field in swarm.ContainerSpec and in convert logic, use it in the executor
- How to verify it
Missing a test for now (incoming)
- Description for the changelog
Isolation mode (default, process, hyperv) can be set on swarm services to bypass host node defaults

Depends on #34745, otherwise breaks CLI

SwarmKit changes:

moby/swarmkit@872861d...28f91d8

From that list; included in this bump are included:

@friism
Copy link
Contributor

friism commented Aug 7, 2017

Fixes #31616

@thaJeztah
Copy link
Member

@simonferquel looks like you vendored using an older version of vndr; can you update to the current version, and run vndr again?

14:45:45 The result of vndr differs
14:45:45 
14:45:45 ?? vendor/github.com/docker/distribution/vendor.conf
14:45:45 ?? vendor/github.com/docker/libnetwork/vendor.conf
14:45:45 ?? vendor/github.com/docker/swarmkit/vendor.conf
14:45:45 ?? vendor/github.com/moby/buildkit/vendor.conf
14:45:45 ?? vendor/github.com/opencontainers/runc/vendor.conf
14:45:45 
14:45:45 Please vendor your package with github.com/LK4D4/vndr.
14:45:45 

Also, this needs an update of the swagger.yml, and the API version history; https://github.com/moby/moby/blob/master/docs/api/version-history.md

@simonferquel simonferquel force-pushed the swarm-service-isolation branch 2 times, most recently from a8cac79 to 94613bf Compare August 8, 2017 11:29
@simonferquel
Copy link
Contributor Author

Swarm test suite is not executed on Windows. Can't write a usefull test on it. I'll just make a test putting an explicit "default" isolation mode, and will inspect service and container to check if it is not empty.

@@ -2260,7 +2260,9 @@ definitions:
ConfigName is the name of the config that this references, but this is just provided for
lookup/display purposes. The config in the reference will be identified by its ID.
type: "string"

Isolation:
Copy link
Member

@thaJeztah thaJeztah Aug 8, 2017

Choose a reason for hiding this comment

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

Shouldn't this go into TaskTemplate.ContainerSpec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the case :)

Copy link
Member

Choose a reason for hiding this comment

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

oh boy, you're right; It looked as if it was at the wrong indentation level, but you're right. Sorry, my mistake ha!

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

left some notes

api/swagger.yaml Outdated

Isolation:
description: "Isolation mode of the containers running the service (default, process, hyperv..."
type: "string"
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps add an enum - what is the behaviour if "" is passed? Is that the same as default?

            enum:
              - "default"
              - "process"
              - "hyperv"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"" or null have the same behavior as default (except service inspect will report with an explicit "default" value for isolation).
I am not completely certain about making it an enum btw, as underlying executor (hcs for windows) might introduce new isolation mode. I'll check on container/create messages and harmonize that.

api/swagger.yaml Outdated
@@ -2260,7 +2260,9 @@ definitions:
ConfigName is the name of the config that this references, but this is just provided for
lookup/display purposes. The config in the reference will be identified by its ID.
type: "string"

Isolation:
description: "Isolation mode of the containers running the service (default, process, hyperv..."
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps the same terminology as is used on docker run, and add a note that it's only used for Windows containers;

description: |
  Container isolation technology to use for the container.

  <p><br /></p>

  > **Note**: Container isolation is only used for Windows containers.
  > This field is ignored for Linux containers.

(the <p><br /></p> is a bit hacky, but I haven't found another way to add spacing yet 😄)

@simonferquel simonferquel force-pushed the swarm-service-isolation branch 2 times, most recently from 01ca146 to 967fe0c Compare August 8, 2017 13:44
@simonferquel
Copy link
Contributor Author

@thaJeztah fixed the doc (used the same exact description and enum as on HostConfig)
We'll need to wait for moby/swarmkit#2342 to be merged, update once again the vendoring before merging this one

@thaJeztah
Copy link
Member

@simonferquel you forgot this one; 967fe0c#r131908016 😇

@simonferquel simonferquel force-pushed the swarm-service-isolation branch 2 times, most recently from f56ac1c to 016b4c5 Compare August 10, 2017 09:30
@thaJeztah
Copy link
Member

@simonferquel this needs a rebase

@coolljt0725
Copy link
Contributor

coolljt0725 commented Aug 22, 2017

ping @simonferquel needs refactor to fix the conflict

@simonferquel simonferquel force-pushed the swarm-service-isolation branch 2 times, most recently from 0b709b3 to 3787b2e Compare August 29, 2017 14:37
@simonferquel simonferquel force-pushed the swarm-service-isolation branch from 3787b2e to 548ff8a Compare September 6, 2017 08:59
@simonferquel simonferquel force-pushed the swarm-service-isolation branch 2 times, most recently from 29c91b0 to 688cf6e Compare October 12, 2017 08:58
@simonferquel
Copy link
Contributor Author

Since the PR Swarmkit side has been merged, I rebased and refreshed this PR.
However, Isolation field on swarm side has moved from a free form string to an enum, with an explicit "Default" value, so I can't use the fact that I could have both and "default" valid strings to make a Linux integration kit.

What I want to do then, is to introduce more unit testing, that would hopefully cover all aspects of the PR

@simonferquel simonferquel force-pushed the swarm-service-isolation branch 2 times, most recently from 63372c4 to ad51f45 Compare October 12, 2017 10:05
@simonferquel
Copy link
Contributor Author

Done (made a bit of cleanup for reusing Isolation type instead of a free string, and added tests to make sure conversions and executors take the change into account)

@simonferquel simonferquel force-pushed the swarm-service-isolation branch from ad51f45 to efceb52 Compare October 20, 2017 13:42
@simonferquel
Copy link
Contributor Author

I just rebased it to see if the plugin tests still fail. Overwise I think the needs/vendoring flag can be removed (the pr now references swarmkit master)

@simonferquel
Copy link
Contributor Author

Hmm swarmkit vendoring update seem to have broken DockerSwarmSuite.TestSwarmVolumePlugin somehow. Not sure why, but I could use some help here...

@simonferquel simonferquel force-pushed the swarm-service-isolation branch from efceb52 to b3ace3b Compare October 24, 2017 10:28
@simonferquel
Copy link
Contributor Author

Ok, found the reason of the test regression: error details are reported in a separate task status field now. Updated the test, amended my commit, waiting for test results.

@simonferquel simonferquel force-pushed the swarm-service-isolation branch from b3ace3b to ea63d05 Compare October 24, 2017 11:35
@simonferquel
Copy link
Contributor Author

@thaJeztah could you update your review ? Want to make sure I did update the right swagger stuff.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, but needs a minor rebase

@thaJeztah
Copy link
Member

ping @cpuguy83 @dnephin PTAL

@thaJeztah thaJeztah mentioned this pull request Oct 30, 2017
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
@vieux
Copy link
Contributor

vieux commented Nov 1, 2017

LGTM ping @cpuguy83 @dnephin

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

9 participants