Commit Graph

10 Commits

Author SHA1 Message Date
Aaron Lehmann c9fdf9abf8 Add force option to service update
Currently, there's no way to restart the tasks of a service without
making an actual change to the service. This leads to us giving awkward
workarounds as in
https://github.com/docker/docker.github.io/pull/178/files, where we tell
people to scale a service up and down to restore balance, or make
unnecessary changes to trigger a restart.

This change adds a --force option to "docker service update", which
forces the service to be updated even if no changes require that.

Since rolling update parameters are respected, the user can use
"docker service --force" to do a rolling restart. For example, the
following is supported:

   docker service update --force --update-parallelism 2 \
   --update-delay 5s myservice

Since the default value of --update-parallelism is 1, the default
behavior is to restart the service one task at a time.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-10-21 17:43:27 -07:00
Aaron Lehmann 6d4b527699 Service update failure thresholds and rollback
This adds support for two enhancements to swarm service rolling updates:

- Failure thresholds: In Docker 1.12, a service update could be set up
  to either pause or continue after a single failure occurs. This adds
  an --update-max-failure-ratio flag that controls how many tasks need to
  fail to update for the update as a whole to be considered a failure. A
  counterpart flag, --update-monitor, controls how long to monitor each
  task for a failure after starting it during the update.

- Rollback flag: service update --rollback reverts the service to its
  previous version. If a service update encounters task failures, or
  fails to function properly for some other reason, the user can roll back
  the update.

SwarmKit also has the ability to roll back updates automatically after
hitting the failure thresholds, but we've decided not to expose this in
the Docker API/CLI for now, favoring a workflow where the decision to
roll back is always made by an admin. Depending on user feedback, we may
add a "rollback" option to --update-failure-action in the future.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-10-18 10:09:50 -07:00
Kay Yan bc32fcabeb Fix conversion of restart-policy from GRPC
restart-condition for services from "on_failure" to "on-failure".

Since GRPC does not support dashes in properties, this change
added a conversion when _setting_ the restart-condition.

However, when inspecting a service, no conversion took place
from the internal GRPC value, resulting in "on_failure" to
be shown.

This change updates the conversion to fix this, and removes
a "hack" that was previously used for this, now using a
Switch to compare to actual types.

Before this change:

    docker service create --name web --restart-condition=on-failure nginx:alpine

    docker service inspect --format '{{ json .Spec.TaskTemplate.RestartPolicy }}' web
    {"Condition":"on_failure","MaxAttempts":0}

Afer this change:

    docker service create --name web --restart-condition=on-failure nginx:alpine

    docker service inspect --format '{{ json .Spec.TaskTemplate.RestartPolicy }}' web
    {"Condition":"on-failure","MaxAttempts":0}

Signed-off-by: Kay Yan <kay.yan@daocloud.io>
2016-09-30 15:54:47 +08:00
allencloud c413d4177b return err when both two service mode in request
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-09-17 19:04:46 +08:00
Jana Radhakrishnan 99a98ccc14 Add support for docker run in swarm mode overlay
This PR adds support for running regular containers to be connected to
swarm mode multi-host network so that:
    - containers connected to the same network across the cluster can
      discover and connect to each other.
    - Get access to services(and their associated loadbalancers)
      connected to the same network

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-09-07 21:20:41 -07:00
Michael Crosby 91e197d614 Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-09-07 11:05:58 -07:00
Aaron Lehmann 57ae29aa74 Add failure action for rolling updates
This changes the default behavior so that rolling updates will not
proceed once an updated task fails to start, or stops running during the
update. Users can use docker service inspect --pretty servicename to see
the update status, and if it pauses due to a failure, it will explain
that the update is paused, and show the task ID that caused it to pause.
It also shows the time since the update started.

A new --update-on-failure=(pause|continue) flag selects the
behavior. Pause means the update stops once a task fails, continue means
the old behavior of continuing the update anyway.

In the future this will be extended with additional behaviors like
automatic rollback, and flags controlling parameters like how many tasks
need to fail for the update to stop proceeding. This is a minimal
solution for 1.12.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-07-25 08:51:19 -07:00
Stephen J Day e778ba2d5b
swarm: add log driver support for services
Adds log driver support for service creation and update. Add flags
`--log-driver` and `--log-opt` to match `docker run`. Log drivers are
configured per service.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-07-15 21:39:27 -07:00
Vincent Demeester a859a33647
Use "on-failure" for both containers and services
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-07-07 11:32:19 +02:00
Tonis Tiigi 534a90a993 Add Swarm management backend
As described in our ROADMAP.md, introduce new Swarm management API
endpoints relying on swarmkit to deploy services. It currently vendors
docker/engine-api changes.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-06-13 22:16:18 -07:00