Merge pull request #80263 from tedyu/job-ctrl-early

Skip unnecessary operations if diff is <= 0
This commit is contained in:
Kubernetes Prow Robot 2019-07-17 21:28:48 -07:00 committed by GitHub
commit 91e17af5ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -746,6 +746,9 @@ func (jm *JobController) manageJob(activePods []*v1.Pod, succeeded int32, job *b
utilruntime.HandleError(fmt.Errorf("More active than wanted: job %q, want %d, have %d", jobKey, wantActive, active))
diff = 0
}
if diff == 0 {
return active, nil
}
jm.expectations.ExpectCreations(jobKey, int(diff))
errCh = make(chan error, diff)
klog.V(4).Infof("Too few pods running job %q, need %d, creating %d", jobKey, wantActive, diff)