Skip to content

Commit

Permalink
updater: Check entire service spec when deciding whether to replace o…
Browse files Browse the repository at this point in the history
…ngoing update

Currently, updater checks isServiceDirty to decide whether an existing
update should be restarted. This only checks the task spec and the
endpoint spec, so it will ignore changes to fields like UpdateConfig.
For example, it's not possible to change just the parallelism while an
update is already in progress. Fix this by comparing the whole spec.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
  • Loading branch information
aaronlehmann committed Sep 6, 2016
1 parent 27fbaef commit f2ba23b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions manager/orchestrator/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (u *UpdateSupervisor) Update(ctx context.Context, cluster *api.Cluster, ser
id := service.ID

if update, ok := u.updates[id]; ok {
if !update.isServiceDirty(service) {
if reflect.DeepEqual(service.Spec, update.newService.Spec) {
// There's already an update working towards this goal.
return
}
Expand Down Expand Up @@ -375,11 +375,6 @@ func (u *Updater) isTaskDirty(t *api.Task) bool {
(t.Endpoint != nil && !reflect.DeepEqual(u.newService.Spec.Endpoint, t.Endpoint.Spec))
}

func (u *Updater) isServiceDirty(service *api.Service) bool {
return !reflect.DeepEqual(u.newService.Spec.Task, service.Spec.Task) ||
!reflect.DeepEqual(u.newService.Spec.Endpoint, service.Spec.Endpoint)
}

func (u *Updater) isSlotDirty(slot slot) bool {
return len(slot) > 1 || (len(slot) == 1 && u.isTaskDirty(slot[0]))
}
Expand Down

0 comments on commit f2ba23b

Please sign in to comment.