Skip to content

Commit c61bc83

Browse files
authored
system deployments: remove old rolling eval creation (#27007)
When using deployments, the deployment watcher emits all the evals we expect to see to step through the deployment once each allocation becomes healthy for `min_healthy_time`. But we left the old rolling-update eval code in place and with the new job parsing of the `update` block that ends up emitting a eval immediately with a zero wait time and we don't end up respecting the `min_healthy_time`. This is all driven from the deployment watcher now, so we can simply remove it from the scheduler.
1 parent a4d9573 commit c61bc83

File tree

2 files changed

+3
-37
lines changed

2 files changed

+3
-37
lines changed

scheduler/scheduler_system.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ type SystemScheduler struct {
5252
deployment *structs.Deployment
5353

5454
limitReached bool
55-
nextEval *structs.Evaluation
5655

5756
failedTGAllocs map[string]*structs.AllocMetric
5857
queuedAllocs map[string]int
@@ -100,7 +99,7 @@ func (s *SystemScheduler) Process(eval *structs.Evaluation) (err error) {
10099
// Verify the evaluation trigger reason is understood
101100
if !s.canHandle(eval.TriggeredBy) {
102101
desc := fmt.Sprintf("scheduler cannot handle '%s' evaluation reason", eval.TriggeredBy)
103-
return setStatus(s.logger, s.planner, s.eval, s.nextEval, nil,
102+
return setStatus(s.logger, s.planner, s.eval, nil, nil,
104103
s.failedTGAllocs, s.planAnnotations, structs.EvalStatusFailed, desc,
105104
s.queuedAllocs, s.deployment.GetID())
106105
}
@@ -114,15 +113,15 @@ func (s *SystemScheduler) Process(eval *structs.Evaluation) (err error) {
114113
progress := func() bool { return progressMade(s.planResult) }
115114
if err := retryMax(limit, s.process, progress); err != nil {
116115
if statusErr, ok := err.(*SetStatusError); ok {
117-
return setStatus(s.logger, s.planner, s.eval, s.nextEval, nil,
116+
return setStatus(s.logger, s.planner, s.eval, nil, nil,
118117
s.failedTGAllocs, s.planAnnotations, statusErr.EvalStatus, err.Error(),
119118
s.queuedAllocs, s.deployment.GetID())
120119
}
121120
return err
122121
}
123122

124123
// Update the status to complete
125-
return setStatus(s.logger, s.planner, s.eval, s.nextEval, nil,
124+
return setStatus(s.logger, s.planner, s.eval, nil, nil,
126125
s.failedTGAllocs, s.planAnnotations, structs.EvalStatusComplete, "",
127126
s.queuedAllocs, s.deployment.GetID())
128127
}
@@ -190,17 +189,6 @@ func (s *SystemScheduler) process() (bool, error) {
190189
return true, nil
191190
}
192191

193-
// If the limit of placements was reached we need to create an evaluation
194-
// to pickup from here after the stagger period.
195-
if s.limitReached && s.nextEval == nil {
196-
s.nextEval = s.eval.NextRollingEval(s.job.Update.MinHealthyTime)
197-
if err := s.planner.CreateEval(s.nextEval); err != nil {
198-
s.logger.Error("failed to make next eval for rolling update", "error", err)
199-
return false, err
200-
}
201-
s.logger.Debug("rolling update limit reached, next eval created", "next_eval_id", s.nextEval.ID)
202-
}
203-
204192
// Submit the plan
205193
if s.eval.AnnotatePlan {
206194
s.plan.Annotations = s.planAnnotations

scheduler/scheduler_system_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -702,28 +702,6 @@ func TestSystemSched_JobModify_Rolling(t *testing.T) {
702702
}
703703

704704
h.AssertEvalStatus(t, structs.EvalStatusComplete)
705-
706-
// Ensure a follow up eval was created
707-
eval = h.Evals[0]
708-
if eval.NextEval == "" {
709-
t.Fatalf("missing next eval")
710-
}
711-
712-
// Check for create
713-
if len(h.CreateEvals) == 0 {
714-
t.Fatalf("missing created eval")
715-
}
716-
create := h.CreateEvals[0]
717-
if eval.NextEval != create.ID {
718-
t.Fatalf("ID mismatch")
719-
}
720-
if create.PreviousEval != eval.ID {
721-
t.Fatalf("missing previous eval")
722-
}
723-
724-
if create.TriggeredBy != structs.EvalTriggerRollingUpdate {
725-
t.Fatalf("bad: %#v", create)
726-
}
727705
}
728706

729707
func TestSystemSched_JobModify_InPlace(t *testing.T) {

0 commit comments

Comments
 (0)