Skip to content

Commit 803b49c

Browse files
authored
Create indexed-job.yaml
1 parent df73b95 commit 803b49c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: 'indexed-job'
5+
spec:
6+
completions: 5
7+
parallelism: 3
8+
completionMode: Indexed
9+
template:
10+
spec:
11+
restartPolicy: Never
12+
initContainers:
13+
- name: 'input'
14+
image: 'docker.io/library/bash'
15+
command:
16+
- "bash"
17+
- "-c"
18+
- |
19+
items=(foo bar baz qux xyz)
20+
echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt
21+
volumeMounts:
22+
- mountPath: /input
23+
name: input
24+
containers:
25+
- name: 'worker'
26+
image: 'docker.io/library/busybox'
27+
command:
28+
- "rev"
29+
- "/input/data.txt"
30+
volumeMounts:
31+
- mountPath: /input
32+
name: input
33+
volumes:
34+
- name: input
35+
emptyDir: {}

0 commit comments

Comments
 (0)