From 5f8026ab88f026ac1e6efa5a9ef0392df894a7c0 Mon Sep 17 00:00:00 2001 From: Andrew Hsu Date: Fri, 25 Aug 2017 11:29:33 -0700 Subject: [PATCH] vndr swarmkit to bring in fix for PullOptions Signed-off-by: Andrew Hsu --- components/engine/vendor.conf | 2 +- .../swarmkit/manager/orchestrator/task.go | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/components/engine/vendor.conf b/components/engine/vendor.conf index e365a9a497..76b5ae515c 100644 --- a/components/engine/vendor.conf +++ b/components/engine/vendor.conf @@ -108,7 +108,7 @@ github.com/containerd/containerd 6e23458c129b551d5c9871e5174f6b1b7f6d1170 https: github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4 # cluster -github.com/docker/swarmkit a0a7f6f663c35c92ddcd73e2c1b97b0f4ed8caf3 +github.com/docker/swarmkit bf3d9a21fa618289839963138923b1534103486a github.com/gogo/protobuf v0.4 github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a github.com/google/certificate-transparency d90e65c3a07988180c5b1ece71791c0b6506826e diff --git a/components/engine/vendor/github.com/docker/swarmkit/manager/orchestrator/task.go b/components/engine/vendor/github.com/docker/swarmkit/manager/orchestrator/task.go index 32a22d5f5a..0a4218ffc4 100644 --- a/components/engine/vendor/github.com/docker/swarmkit/manager/orchestrator/task.go +++ b/components/engine/vendor/github.com/docker/swarmkit/manager/orchestrator/task.go @@ -67,7 +67,29 @@ func IsTaskDirty(s *api.Service, t *api.Task) bool { return false } - return !reflect.DeepEqual(s.Spec.Task, t.Spec) || + // Make a deep copy of the service and task spec for the comparison. + serviceTaskSpec := *s.Spec.Task.Copy() + + // For non-failed tasks with a container spec runtime that have already + // pulled the required image (i.e., current state is between READY and + // RUNNING inclusively), ignore the value of the `PullOptions` field by + // setting the copied service to have the same PullOptions value as the + // task. A difference in only the `PullOptions` field should not cause + // a running (or ready to run) task to be considered 'dirty' when we + // handle updates. + // See https://github.com/docker/swarmkit/issues/971 + currentState := t.Status.State + // Ignore PullOpts if the task is desired to be in a "runnable" state + // and its last known current state is between READY and RUNNING in + // which case we know that the task either successfully pulled its + // container image or didn't need to. + ignorePullOpts := t.DesiredState <= api.TaskStateRunning && currentState >= api.TaskStateReady && currentState <= api.TaskStateRunning + if ignorePullOpts && serviceTaskSpec.GetContainer() != nil && t.Spec.GetContainer() != nil { + // Modify the service's container spec. + serviceTaskSpec.GetContainer().PullOptions = t.Spec.GetContainer().PullOptions + } + + return !reflect.DeepEqual(serviceTaskSpec, t.Spec) || (t.Endpoint != nil && !reflect.DeepEqual(s.Spec.Endpoint, t.Endpoint.Spec)) }