-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcronjob.yaml
32 lines (31 loc) · 995 Bytes
/
cronjob.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
apiVersion: batch/v1
kind: CronJob
metadata:
name: ping
spec:
schedule: "*/3 * * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 3
jobTemplate:
spec:
template:
metadata:
annotations:
sidecar.istio.io/inject: "false"
labels:
app: cronjob
spec:
containers:
- name: ping
image: buildpack-deps:curl
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -ec
- curl -sS http://quarkus-getting-started.default.34.121.210.234.sslip.io/hello
#lifecycle:
# postStart:
# exec:
# command: ["/bin/sh", "-c", "if [ $(kubectl get jobs -l='job-name=ping' --field-selector status.succeeded=true --output=json | jq '.items | length') -eq 3 ]; then kubectl patch cronjob ping -p '{\"spec\":{\"suspend\":true}}'; fi"]
restartPolicy: OnFailure
suspend: false