Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KEP-3998: Add JobSuccessPolicy Documentation
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...docs/reference/command-line-tools-reference/feature-gates/job-success-policy.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: JobSuccessPolicy | ||
content_type: feature_gate | ||
|
||
_build: | ||
list: never | ||
render: false | ||
|
||
stages: | ||
- stage: alpha | ||
defaultValue: false | ||
fromVersion: "1.30" | ||
--- | ||
Allow users to specify when a Job can be declared as succeeded based on the set of succeeded pods. |
25 changes: 25 additions & 0 deletions
25
content/en/examples/controllers/job-success-policy-example.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
spec: | ||
parallelism: 10 | ||
completions: 10 | ||
completionMode: Indexed # Required for the feature | ||
successPolicy: | ||
rules: | ||
- succeededIndexes: 0-2 | ||
succeededCount: 1 | ||
template: | ||
spec: | ||
containers: | ||
- name: main | ||
image: python | ||
command: # The jobs succeed as there is one succeeded index | ||
# among indexes 0, 1, and 2. | ||
- python3 | ||
- -c | ||
- | | ||
import os, sys | ||
if os.environ.get("JOB_COMPLETION_INDEX") == "1": | ||
sys.exit(0) | ||
else: | ||
sys.exit(1) |