apiVersion: batch/v1
kind: Job
metadata:
name: lifecycle-check1
spec:
ttlSecondsAfterFinished: 1
template:
spec:
containers:
- name: app1
image: artifactory.<URL>:5000/location/alpine:latest
command: ["sh", "-c"]
args:
- |
echo Start.
sleep 10
touch /message/processDone
exit 0
volumeMounts:
- mountPath: /message
name: test-volume
- name: app2
image: artifactory.<URL>:5000/location/alpine:latest
command: ["sh", "-c"]
lifecycle:
type: Sidecar
args:
- |
trap 'echo "Trapped SIGTERM"; sleep 3; echo "See you!!"; exit 0' TERM
echo Start.
while true
do
date
# sleep 20
if [ -f /message/processDone ]; then
echo "File found, exiting"
exit 0
else
echo "file not found yet"
fi
done
volumeMounts:
- mountPath: /message
name: test-volume
volumes:
- name: test-volume
emptyDir: {}
restartPolicy: Never
backoffLimit: 4
# terminationGracePeriodSeconds: 30