From b1df4611fe3a0bcf7f7a5ebab25d861eb4a36a32 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Sun, 8 Apr 2018 15:23:19 -0700 Subject: [PATCH] Only reschedule allowed deployment allocs --- scheduler/reconcile_util.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scheduler/reconcile_util.go b/scheduler/reconcile_util.go index e64e8c9b5..0b024917a 100644 --- a/scheduler/reconcile_util.go +++ b/scheduler/reconcile_util.go @@ -321,8 +321,15 @@ func shouldFilter(alloc *structs.Allocation, isBatch bool) (untainted, ignore bo // updateByReschedulable is a helper method that encapsulates logic for whether a failed allocation // should be rescheduled now, later or left in the untainted set func updateByReschedulable(alloc *structs.Allocation, now time.Time, evalID string) (rescheduleNow, rescheduleLater bool, rescheduleTime time.Time) { - rescheduleTime, eligible := alloc.NextRescheduleTime() + + // If the allocation is part of a deployment, only allow it to reschedule if + // it has been marked eligible for it explicitly. + if alloc.DeploymentID != "" && !alloc.DesiredTransition.ShouldReschedule() { + return + } + // Reschedule if the eval ID matches the alloc's followup evalID or if its close to its reschedule time + rescheduleTime, eligible := alloc.NextRescheduleTime() if eligible && (alloc.FollowupEvalID == evalID || rescheduleTime.Sub(now) <= rescheduleWindowSize) { rescheduleNow = true return