mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 09:25:46 +03:00
scheduler: DesiredCanaries can be set on every pass safely
The reconcile loop sets `DeploymentState.DesiredCanaries` only on the first pass through the loop and if the job is not paused/pending. In MRD, deployments will make one pass though the loop while "pending", and were not ever getting `DesiredCanaries` set. We can't set it in the initial `DeploymentState` constructor because the first pass through setting up canaries expects it's not there yet. However, this value is static for a given version of a job because it's coming from the update stanza, so it's safe to re-assign the value on subsequent passes.
This commit is contained in:
@@ -428,12 +428,12 @@ func (a *allocReconciler) computeGroup(group string, all allocSet) bool {
|
||||
strategy := tg.Update
|
||||
canariesPromoted := dstate != nil && dstate.Promoted
|
||||
requireCanary := numDestructive != 0 && strategy != nil && len(canaries) < strategy.Canary && !canariesPromoted
|
||||
if requireCanary {
|
||||
dstate.DesiredCanaries = strategy.Canary
|
||||
}
|
||||
if requireCanary && !a.deploymentPaused && !a.deploymentFailed {
|
||||
number := strategy.Canary - len(canaries)
|
||||
desiredChanges.Canary += uint64(number)
|
||||
if !existingDeployment {
|
||||
dstate.DesiredCanaries = strategy.Canary
|
||||
}
|
||||
|
||||
for _, name := range nameIndex.NextCanaries(uint(number), canaries, destructive) {
|
||||
a.result.place = append(a.result.place, allocPlaceResult{
|
||||
|
||||
Reference in New Issue
Block a user