generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 53
/
jobset-with-network.yaml
61 lines (61 loc) · 1.84 KB
/
jobset-with-network.yaml
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
apiVersion: jobset.x-k8s.io/v1alpha2
kind: JobSet
metadata:
name: network-jobset
spec:
network:
# this field allows pods to be reached via their hostnames
# hostname: <jobSet.name>-<spec.replicatedJob.name>-<job-index>-<pod-index>.<subdomain>
# example: network-jobset-leader-0-0.example
enableDNSHostnames: true
# subdomain is a field for a network subdomain name
# defaults to <jobSet.name> if not set.
subdomain: example
# this field indicates if DNS records of pods should be published before the pods are ready.
# default to true
publishNotReadyAddresses: true
replicatedJobs:
- name: leader
replicas: 1
template:
spec:
backoffLimit: 0
completions: 1
parallelism: 1
template:
spec:
containers:
- name: leader
image: bash:latest
command:
- bash
- -xc
- |
sleep 3600
- name: workers
replicas: 1
template:
spec:
backoffLimit: 0
completions: 2
parallelism: 2
template:
spec:
containers:
- name: worker
image: bash:latest
command:
- bash
- -xc
- |
sleep 20
success_count=0
for i in {1..2}; do
if ping -c 1 network-jobset-leader-0-0.example; then
((success_count++))
fi
done
if [[ $success_count -eq 2 ]]; then
echo "leader is up"
fi
while true; do sleep 3600; done