Add --health-* flags to service create and update#27369
Add --health-* flags to service create and update#27369vdemeester merged 2 commits intomoby:masterfrom
Conversation
|
Looks like there's some golint errors; |
|
ping @stevvooe @aluzzardi @talex5 |
|
Thanks, I've fixed the lint errors. However, the code still doesn't compile on CI because it depends on moby/swarmkit#1641. If the swarmkit PR is approved (and updated on vendor) I'll rebase this PR and it should compile cleanly. |
|
@cezarsa to make CI pass during review, you can add a second commit that makes those changes in the vendored files. The "vendor" CI will fail, but all other tests can pass then. Once we're in "code review", and moby/swarmkit#1641 is merged, you can then update the PR to update the vendor.sh an get the actual changes from SwarmKit |
|
Thanks for the tip @thaJeztah. Tests are passing now. |
|
oh boy, looks like this needs a rebase now. 😢 |
4d4c8d4 to
3a97971
Compare
13ecf11 to
ba9bb00
Compare
|
@cezarsa something is missing somehow. The healthcheck I provide for the service doesn't end-up into the container(s) created. As shown in |
|
Also ping @dongluochen and @aaronlehmann FYI! |
|
Sorry @vdemeester, there was a bit of code missing. I just added it in 3d0132f I made this mistake because similar code exists in swarmkit and I thought the daemon was using it, sorry. (I guess it will use in the future?) Just tested it now and everything seems to be working now: |
|
I test this code and it looks good to me. One small problem would be the default value for healthcheck interval and retries are not shown. But we haven't done it in |
Signed-off-by: Cezar Sa Espinola <[email protected]>
|
looks like it's rebased |
|
@cezarsa could you squash all the commits that are not related to vendoring ? (this way we have one commit for vendoring, one for the actual diff) |
A HealthConfig entry was added to the ContainerSpec associated with the service being created or updated. Signed-off-by: Cezar Sa Espinola <[email protected]>
|
Done. :) |
|
@cezarsa perfect ! Thanks ! |
Pull request moby#27745 added support for the client to talk to older versions of the daemon. Various flags were added to docker 1.13 that are not compatible with older daemons. This PR adds annotations to those flags, so that they are automatically hidden if the daemon is older than docker 1.13 (API 1.25). Not all new flags affect the API (some are client-side only). The following PR's added new flags to docker 1.13 that affect the API; - moby#23430 added `--cpu-rt-period`and `--cpu-rt-runtime` - moby#27800 / moby#25317 added `--group` / `--group-add` / `--group-rm` - moby#27702 added `--network` to `docker build` - moby#25962 added `--attachable` to `docker network create` - moby#27998 added `--compose-file` to `docker stack deploy` - moby#22566 added `--stop-timeout` to `docker run` and `docker create` - moby#26061 added `--init` to `docker run` and `docker create` - moby#26941 added `--init-path` to `docker run` and `docker create` - moby#27958 added `--cpus` on `docker run` / `docker create` - moby#27567 added `--dns`, `--dns-opt`, and `--dns-search` to `docker service create` - moby#27596 added `--force` to `docker service update` - moby#27857 added `--hostname` to `docker service create` - moby#28031 added `--hosts`, `--host-add` / `--host-rm` to `docker service create` and `docker service update` - moby#28076 added `--tty` on `docker service create` / `docker service update` - moby#26421 added `--update-max-failure-ratio`, `--update-monitor` and `--rollback` on `docker service update` - moby#27369 added `--health-cmd`, `--health-interval`, `--health-retries`, `--health-timeout` and `--no-healthcheck` options to `docker service create` and `docker service update` Signed-off-by: Sebastiaan van Stijn <[email protected]>
Add --health-* flags to service create and update
Pull request moby/moby#27745 added support for the client to talk to older versions of the daemon. Various flags were added to docker 1.13 that are not compatible with older daemons. This PR adds annotations to those flags, so that they are automatically hidden if the daemon is older than docker 1.13 (API 1.25). Not all new flags affect the API (some are client-side only). The following PR's added new flags to docker 1.13 that affect the API; - moby/moby#23430 added `--cpu-rt-period`and `--cpu-rt-runtime` - moby/moby#27800 / moby/moby#25317 added `--group` / `--group-add` / `--group-rm` - moby/moby#27702 added `--network` to `docker build` - moby/moby#25962 added `--attachable` to `docker network create` - moby/moby#27998 added `--compose-file` to `docker stack deploy` - moby/moby#22566 added `--stop-timeout` to `docker run` and `docker create` - moby/moby#26061 added `--init` to `docker run` and `docker create` - moby/moby#26941 added `--init-path` to `docker run` and `docker create` - moby/moby#27958 added `--cpus` on `docker run` / `docker create` - moby/moby#27567 added `--dns`, `--dns-opt`, and `--dns-search` to `docker service create` - moby/moby#27596 added `--force` to `docker service update` - moby/moby#27857 added `--hostname` to `docker service create` - moby/moby#28031 added `--hosts`, `--host-add` / `--host-rm` to `docker service create` and `docker service update` - moby/moby#28076 added `--tty` on `docker service create` / `docker service update` - moby/moby#26421 added `--update-max-failure-ratio`, `--update-monitor` and `--rollback` on `docker service update` - moby/moby#27369 added `--health-cmd`, `--health-interval`, `--health-retries`, `--health-timeout` and `--no-healthcheck` options to `docker service create` and `docker service update` Signed-off-by: Sebastiaan van Stijn <[email protected]> Upstream-commit: 5d2722f83db9e301c6dcbe1c562c2051a52905db Component: cli
- What I did
This PR is related to #25303 and adds
--health-*and--no-healthcheckflags to service create and update commands.- How I did it
The
ContainerSpecwas modified to include aHealthConfiginstance which is them serialized to swarmkit. I also created a PR in swarmkit (moby/swarmkit#1641) which needs to be merged before this PR can be accepted.For service create the behavior is similar to
docker runwith the same checks validating conflicting arguments. On service update it's also valid to set things like--health-cmd ""and--health-timeout 0to allow inheriting these attributes from the image. Setting--no-healthcheckwill reset the HealthConfig to the NONE test and remove every other attribute.- How to verify it
Some test case were added to check if the commands are behaving correctly.
- Description for the changelog
Add --health-* and --no-healthcheck to service create and update
- A picture of a cute animal (not mandatory but encouraged)
🐱