Merge pull request #208 from andrewhsu/fix-pullopts
[17.06] vndr swarmkit to bring in fix for PullOptions
This commit is contained in:
@@ -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
|
||||
|
||||
+23
-1
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user