-
Notifications
You must be signed in to change notification settings - Fork 631
Expand file tree
/
Copy pathjob.yaml
More file actions
68 lines (67 loc) · 2.11 KB
/
job.yaml
File metadata and controls
68 lines (67 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{{$HostNetworkMode := DefaultParam .CL2_USE_HOST_NETWORK_PODS false}}
{{$RUN_ON_ARM_NODES := DefaultParam .CL2_RUN_ON_ARM_NODES false}}
{{$TOLERATION := DefaultParam .CL2_TOLERATION ""}}
{{$Image := DefaultParam .Image "registry.k8s.io/pause:3.9"}}
{{$podPayloadSize := DefaultParam .CL2_JOB_POD_PAYLOAD_SIZE 0}}
{{$RuntimeClassName := DefaultParam .CL2_RUNTIME_CLASS_NAME nil}}
apiVersion: batch/v1
kind: Job
metadata:
name: {{.Name}}
labels:
group: load
spec:
backoffLimit: {{.ReplicasMin}}
manualSelector: true
parallelism: {{RandIntRange .ReplicasMin .ReplicasMax}}
completions: {{.Completions}}
selector:
matchLabels:
name: {{.Name}}
template:
metadata:
labels:
group: load
name: {{.Name}}
spec:
{{if $RuntimeClassName}}
runtimeClassName: {{$RuntimeClassName}}
{{end}}
hostNetwork: {{$HostNetworkMode}}
containers:
- name: {{.Name}}
# TODO(#799): We should test the "run-to-completion" workflow and hence don't use pause pods.
image: {{$Image}}
env:
- name: ENV_VAR
value: {{RandDataWithSeed $podPayloadSize .Name}}
resources:
# Keep the CpuRequest/MemoryRequest request equal percentage of 1-core, 4GB node.
# For now we're setting it to 0.5%.
requests:
cpu: 5m
memory: "20M"
restartPolicy: OnFailure
terminationGracePeriodSeconds: 1
# Add not-ready/unreachable tolerations for 15 minutes so that node
# failure doesn't trigger pod deletion.
tolerations:
- key: "node.kubernetes.io/not-ready"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 900
- key: "node.kubernetes.io/unreachable"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 900
{{if $RUN_ON_ARM_NODES}}
- key: "kubernetes.io/arch"
operator: Equal
value: arm64
effect: NoSchedule
{{end}}
{{if $TOLERATION}}
- key: {{$TOLERATION}}
operator: Exists
effect: NoSchedule
{{end}}