Merge pull request #4716 from hashicorp/f-no-reuse-triggerby
Unique TriggerBy for blocked evals
This commit is contained in:
commit
a7de6d1bb1
|
@ -6751,6 +6751,7 @@ const (
|
|||
EvalTriggerFailedFollowUp = "failed-follow-up"
|
||||
EvalTriggerMaxPlans = "max-plan-attempts"
|
||||
EvalTriggerRetryFailedAlloc = "alloc-failure"
|
||||
EvalTriggerQueuedAllocs = "queued-allocs"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -7016,7 +7017,7 @@ func (e *Evaluation) CreateBlockedEval(classEligibility map[string]bool,
|
|||
Namespace: e.Namespace,
|
||||
Priority: e.Priority,
|
||||
Type: e.Type,
|
||||
TriggeredBy: e.TriggeredBy,
|
||||
TriggeredBy: EvalTriggerQueuedAllocs,
|
||||
JobID: e.JobID,
|
||||
JobModifyIndex: e.JobModifyIndex,
|
||||
Status: EvalStatusBlocked,
|
||||
|
|
|
@ -128,7 +128,7 @@ func (s *GenericScheduler) Process(eval *structs.Evaluation) error {
|
|||
switch eval.TriggeredBy {
|
||||
case structs.EvalTriggerJobRegister, structs.EvalTriggerJobDeregister,
|
||||
structs.EvalTriggerNodeDrain, structs.EvalTriggerNodeUpdate,
|
||||
structs.EvalTriggerRollingUpdate,
|
||||
structs.EvalTriggerRollingUpdate, structs.EvalTriggerQueuedAllocs,
|
||||
structs.EvalTriggerPeriodicJob, structs.EvalTriggerMaxPlans,
|
||||
structs.EvalTriggerDeploymentWatcher, structs.EvalTriggerRetryFailedAlloc:
|
||||
default:
|
||||
|
|
|
@ -241,6 +241,10 @@ func TestServiceSched_JobRegister_DiskConstraints(t *testing.T) {
|
|||
t.Fatalf("bad: %#v", h.CreateEvals)
|
||||
}
|
||||
|
||||
if h.CreateEvals[0].TriggeredBy != structs.EvalTriggerQueuedAllocs {
|
||||
t.Fatalf("bad: %#v", h.CreateEvals[0])
|
||||
}
|
||||
|
||||
// Ensure the plan allocated only one allocation
|
||||
var planned []*structs.Allocation
|
||||
for _, allocList := range plan.NodeAllocation {
|
||||
|
|
Loading…
Reference in a new issue