Skip to content

Commit 32fd60c

Browse files
committed
KEP-3998: Make the explanation for rules more clarify
Signed-off-by: Yuki Iwai <[email protected]>
1 parent 105d90a commit 32fd60c

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

content/en/docs/concepts/workloads/controllers/job.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,12 @@ to meet the above use cases. This policy can handle Job successes based on the
577577
number of succeeded pods. After the Job meet success policy, the lingering Pods
578578
are terminated by the Job controller.
579579

580-
When you specify the only `.spec.successPolicy.rules[*].succeededIndexes`,
580+
* When you specify the only `.spec.successPolicy.rules[*].succeededIndexes`,
581581
once all indexes specified in the `succeededIndexes` succeeded, the Job is marked as succeeded.
582-
The `succeededIndexes` must be a list within 0 to `.spec.completions-1` and
583-
must not contain duplicate indexes. The `succeededIndexes` is represented as intervals separated by a hyphen.
584-
The number are listed in represented by the first and last element of the series, separated by a hyphen.
585-
For example, if you want to specify 1, 3, 4, 5 and 7, the `succeededIndexes` is represented as `1,3-5,7`.
586-
587-
When you specify the only `spec.successPolicy.rules[*].succeededCount`,
582+
The `succeededIndexes` must be a list of intervals between 0 and `.spec.completions-1`.
583+
* When you specify the only `spec.successPolicy.rules[*].succeededCount`,
588584
once the number of succeeded indexes reaches the `succeededCount`, the Job is marked as succeeded.
589-
590-
When you specify both `succeededIndexes` and `succeededCount`,
585+
* When you specify both `succeededIndexes` and `succeededCount`,
591586
once the number of succeeded indexes specified in the `succeededIndexes` reaches the `succeededCount`,
592587
the Job is marked as succeeded.
593588

@@ -600,7 +595,10 @@ Here is a manifest for a Job with `successPolicy`:
600595

601596
In the example above, the rule of the success policy specifies that
602597
the Job should be marked succeeded and terminate the lingering Pods
603-
if one of the 0, 1, and 2 indexes succeeded.
598+
if one of the 0, 2, and 3 indexes succeeded.
599+
600+
Note that the `succeededIndexes` is represented as intervals separated by a hyphen.
601+
The number are listed in represented by the first and last element of the series, separated by a hyphen.
604602

605603
{{< note >}}
606604
When you specify both a success policy and some terminating policies such as `.spec.backoffLimit` and `.spec.podFailurePolicy`,

content/en/examples/controllers/job-success-policy-example.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ spec:
66
completionMode: Indexed # Required for the feature
77
successPolicy:
88
rules:
9-
- succeededIndexes: 0-2
9+
- succeededIndexes: 0,2-3
1010
succeededCount: 1
1111
template:
1212
spec:
1313
containers:
1414
- name: main
1515
image: python
1616
command: # The jobs succeed as there is one succeeded index
17-
# among indexes 0, 1, and 2.
17+
# among indexes 0, 2, and 3.
1818
- python3
1919
- -c
2020
- |
2121
import os, sys
22-
if os.environ.get("JOB_COMPLETION_INDEX") == "1":
22+
if os.environ.get("JOB_COMPLETION_INDEX") == "2":
2323
sys.exit(0)
2424
else:
2525
sys.exit(1)

0 commit comments

Comments
 (0)