Fix stack deploy re-deploying service after --force#963
Merged
tiborvass merged 1 commit intodocker:masterfrom Apr 13, 2018
Merged
Fix stack deploy re-deploying service after --force#963tiborvass merged 1 commit intodocker:masterfrom
tiborvass merged 1 commit intodocker:masterfrom
Conversation
When updating a service with the `--force` option, the `ForceUpdate` property of the taskspec is incremented. Stack deploy did not take this into account, and reset this field to its default value (0), causing the service to be re-deployed. This patch copies the existing value before updating the service. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah
commented
Mar 26, 2018
| // Stack deploy does not have a `--force` option. Preserve existing ForceUpdate | ||
| // value so that tasks are not re-deployed if not updated. | ||
| // TODO move this to API client? | ||
| serviceSpec.TaskTemplate.ForceUpdate = service.Spec.TaskTemplate.ForceUpdate |
Member
Author
There was a problem hiding this comment.
I was also comparing serviceSpec with service.Spec here, and noticed there's quite some other properties that differ; not sure if those are expected;
{"Name":"test_redis","Labels":{"com.docker.stack.image":"redis:3.2.8","com.docker.stack.namespace":"test"},"TaskTemplate":{"ContainerSpec":{"Image":"redis:3.2.8@sha256:8eb0cd22644dc1218680db876411f45baac493ac9a0bfd391d6efdef0767ea6b","Labels":{"com.docker.stack.namespace":"test"},"Privileges":{"CredentialSpec":null,"SELinuxContext":null},"Isolation":"default"},"Resources":{},"Placement":{"Platforms":[{"Architecture":"amd64","OS":"linux"}]},"Networks":[{"Target":"x5ce5v6s4fzjdd6eavt9njahb","Aliases":["redis"]}],"ForceUpdate":1,"Runtime":"container"},"Mode":{"Replicated":{"Replicas":1}},"EndpointSpec":{"Mode":"vip"}}
{"Name":"test_redis","Labels":{"com.docker.stack.image":"redis:3.2.8","com.docker.stack.namespace":"test"},"TaskTemplate":{"ContainerSpec":{"Image":"redis:3.2.8 ","Labels":{"com.docker.stack.namespace":"test"},"Privileges":{"CredentialSpec":null,"SELinuxContext":null} },"Resources":{},"Placement":{ },"Networks":[{"Target":"test_default" ,"Aliases":["redis"]}],"ForceUpdate":1 },"Mode":{"Replicated":{ }},"EndpointSpec":{ }}
Collaborator
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


When updating a service with the
--forceoption, theForceUpdateproperty of the taskspec is incremented.Stack deploy did not take this into account, and reset this field to its default value (0), causing the service to be re-deployed.
This patch copies the existing value before updating the service.
fixes moby/moby#36028
- Description for the changelog