From 0babfcc42c94956e605eb9181f61ba2122cffef8 Mon Sep 17 00:00:00 2001 From: Preetha Appan Date: Wed, 25 Apr 2018 10:31:18 -0500 Subject: [PATCH] Make sure that task group has a deployment state before using it --- scheduler/reconcile.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scheduler/reconcile.go b/scheduler/reconcile.go index 54ab330e0..63c9cff72 100644 --- a/scheduler/reconcile.go +++ b/scheduler/reconcile.go @@ -525,10 +525,11 @@ func (a *allocReconciler) computeGroup(group string, all allocSet) bool { // Final check to see if the deployment is complete is to ensure everything // is healthy if deploymentComplete && a.deployment != nil { - dstate := a.deployment.TaskGroups[group] - if dstate.HealthyAllocs < helper.IntMax(dstate.DesiredTotal, dstate.DesiredCanaries) || // Make sure we have enough healthy allocs - (dstate.DesiredCanaries > 0 && !dstate.Promoted) { // Make sure we are promoted if we have canaries - deploymentComplete = false + if dstate, ok := a.deployment.TaskGroups[group]; ok { + if dstate.HealthyAllocs < helper.IntMax(dstate.DesiredTotal, dstate.DesiredCanaries) || // Make sure we have enough healthy allocs + (dstate.DesiredCanaries > 0 && !dstate.Promoted) { // Make sure we are promoted if we have canaries + deploymentComplete = false + } } }