Support Work Queue jobs with variable parallelism

When job.spec.completions is nil, only
one task needs to succeed for the job to succeed,
and parallelism can be scaled freely during runtime.

Added tests.

Release Note:

This causes two minor changes to the API.

First, unset parallelism previously was defaulted to be
equal to completions.  Now it always defaults to 1 if unset.

Second, having parallelism=N and completions unset would previously
be defaulted to 1 completion and N parallelism.
(this is not something we expect people to do, though)
Now, no defaulting occurs in that case, and the job's
behavior is different (any completion causes success).
This commit is contained in:
Eric Tune
2015-12-14 15:26:16 -08:00
parent 3df16731e2
commit 53ee76fe1a
14 changed files with 325 additions and 91 deletions

View File

@@ -908,7 +908,11 @@ func describeJob(job *extensions.Job, events *api.EventList) (string, error) {
selector, _ := extensions.LabelSelectorAsSelector(job.Spec.Selector)
fmt.Fprintf(out, "Selector:\t%s\n", selector)
fmt.Fprintf(out, "Parallelism:\t%d\n", *job.Spec.Parallelism)
fmt.Fprintf(out, "Completions:\t%d\n", *job.Spec.Completions)
if job.Spec.Completions != nil {
fmt.Fprintf(out, "Completions:\t%d\n", *job.Spec.Completions)
} else {
fmt.Fprintf(out, "Completions:\tNot Set\n")
}
if job.Status.StartTime != nil {
fmt.Fprintf(out, "Start Time:\t%s\n", job.Status.StartTime.Time.Format(time.RFC1123Z))
}