diff --git a/images/replication-job/liveness.sh b/images/replication-job/liveness.sh new file mode 100755 index 00000000..c343c24e --- /dev/null +++ b/images/replication-job/liveness.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# This is a script for the complex evaluation of whether Osmosis or other processes are running in the container. +if [ $(ps -ef | grep -E 'java' | grep -v grep | wc -l) -ge 1 ]; then + echo "Osmosis is running." + exit 0 +else + echo "Osmosis is not running!" 1>&2 + exit 1 +fi diff --git a/osm-seed/templates/jobs/replication-job-deployment.yaml b/osm-seed/templates/jobs/replication-job-deployment.yaml index afc4ca75..fe2ea3a8 100644 --- a/osm-seed/templates/jobs/replication-job-deployment.yaml +++ b/osm-seed/templates/jobs/replication-job-deployment.yaml @@ -22,6 +22,16 @@ spec: - name: {{ .Release.Name }}-replication-job-deployment image: {{ .Values.replicationJob.image.name }}:{{ .Values.replicationJob.image.tag }} command: ['/start.sh'] + livenessProbe: + exec: + command: + - /bin/bash + - -c + - /liveness.sh + initialDelaySeconds: 10 + timeoutSeconds: 5 + periodSeconds: 10 + failureThreshold: 3 {{- if .Values.replicationJob.resources.enabled }} resources: requests: