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

@@ -185,6 +185,8 @@ using above links. Then build the image:
$ docker build -t job-wq-2 .
```
### Push the image
For the [Docker Hub](https://hub.docker.com/), tag your app image with
your username and push to the Hub with the below commands. Replace
`<username>` with your Hub username.
@@ -194,6 +196,9 @@ docker tag job-wq-2 <username>/job-wq-2
docker push <username>/job-wq-2
```
You need to push to a public repository or [configure your cluster to be able to access
your private repository](../../../docs/user-guide/images.md).
If you are using [Google Container
Registry](https://cloud.google.com/tools/container-registry/), tag
your app image with your project ID, and push to GCR. Replace
@@ -220,7 +225,6 @@ spec:
selector:
matchLabels:
app: job-wq-2
completions: 1
parallelism: 2
template:
metadata:
@@ -263,17 +267,19 @@ Now wait a bit, then check on the job.
$ ./kubectl describe jobs/job-wq-2
Name: job-wq-2
Namespace: default
Image(s): gcr.io/causal-jigsaw-637/job-wq-2
Image(s): gcr.io/exampleproject/job-wq-2
Selector: app in (job-wq-2)
Parallelism: 2
Completions: 1
Completions: Unset
Start Time: Mon, 11 Jan 2016 17:07:59 -0800
Labels: app=job-wq-2
Pods Statuses: 0 Running / 1 Succeeded / 0 Failed
Pods Statuses: 1 Running / 0 Succeeded / 0 Failed
No volumes.
Events:
FirstSeen LastSeen Count From SubobjectPath Reason Message
───────── ──────── ───── ──── ───────────── ────── ───────
1m 1m 1 {job } SuccessfulCreate Created pod: job-wq-2-7r7b2
FirstSeen LastSeen Count From SubobjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
33s 33s 1 {job-controller } Normal SuccessfulCreate Created pod: job-wq-2-lglf8
$ kubectl logs pods/job-wq-2-7r7b2
Worker with sessionID: bbd72d0a-9e5c-4dd6-abf6-416cc267991f

View File

@@ -6,7 +6,6 @@ spec:
selector:
matchLabels:
app: job-wq-2
completions: 1
parallelism: 2
template:
metadata: