From f2ba23b89c5d27c336e51791201245fe7994b1d8 Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Tue, 6 Sep 2016 11:51:34 -0700 Subject: [PATCH] updater: Check entire service spec when deciding whether to replace ongoing 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 --- manager/orchestrator/updater.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/manager/orchestrator/updater.go b/manager/orchestrator/updater.go index 97cb2fe328..1b9b285eb4 100644 --- a/manager/orchestrator/updater.go +++ b/manager/orchestrator/updater.go @@ -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 } @@ -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])) }