diff --git a/k8s/errors/cronjob-basic-error.yaml b/k8s/errors/cronjob-basic-error.yaml index e1d275d..22cc423 100644 --- a/k8s/errors/cronjob-basic-error.yaml +++ b/k8s/errors/cronjob-basic-error.yaml @@ -22,7 +22,5 @@ spec: command: - /bin/sh - -c - - | - sleep 1 - invalid_command + - sleep 1; invalid_command restartPolicy: Never diff --git a/k8s/errors/cronjob-late-maybe-error.yaml b/k8s/errors/cronjob-late-maybe-error.yaml new file mode 100644 index 0000000..ccb9a22 --- /dev/null +++ b/k8s/errors/cronjob-late-maybe-error.yaml @@ -0,0 +1,32 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: cronjob-late-maybe-error + labels: + type: test-pod +spec: + schedule: "* * * * *" + jobTemplate: + spec: + backoffLimit: 0 + template: + metadata: + labels: + type: test-pod + run: cronjob-late-maybe-error + spec: + containers: + - name: hello + image: busybox:1.28 + imagePullPolicy: IfNotPresent + command: + - /bin/sh + - -c + - | + MINWAIT=0 + MAXWAIT=60 + sleep $((MINWAIT+RANDOM % (MAXWAIT-MINWAIT))) + sleep 3 + r=$((RANDOM%2)) + if [ $r -eq 0 ]; then echo Hello!; else exit 1; fi + restartPolicy: Never diff --git a/k8s/errors/cronjob-late-success.yaml b/k8s/errors/cronjob-late-success.yaml new file mode 100644 index 0000000..19e07b9 --- /dev/null +++ b/k8s/errors/cronjob-late-success.yaml @@ -0,0 +1,30 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: cronjob-late-success + labels: + type: test-pod +spec: + schedule: "* * * * *" + jobTemplate: + spec: + template: + metadata: + labels: + type: test-pod + run: cronjob-late-success + spec: + containers: + - name: hello + image: busybox:1.28 + imagePullPolicy: IfNotPresent + command: + - /bin/sh + - -c + - | + date + MINWAIT=0 + MAXWAIT=60 + sleep $((MINWAIT+RANDOM % (MAXWAIT-MINWAIT))) + echo Hello! + restartPolicy: Never diff --git a/k8s/errors/cronjob-maybe-error.yaml b/k8s/errors/cronjob-maybe-error.yaml new file mode 100644 index 0000000..4947789 --- /dev/null +++ b/k8s/errors/cronjob-maybe-error.yaml @@ -0,0 +1,29 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: cronjob-maybe-error + labels: + type: test-pod +spec: + schedule: "* * * * *" + jobTemplate: + spec: + backoffLimit: 0 + template: + metadata: + labels: + type: test-pod + run: cronjob-maybe-error + spec: + containers: + - name: hello + image: busybox:1.28 + imagePullPolicy: IfNotPresent + command: + - /bin/sh + - -c + - | + sleep 3 + r=$((RANDOM%2)) + if [ $r -eq 0 ]; then echo Hello!; else exit 1; fi + restartPolicy: Never