diff --git a/charts/dbp-moodle/scripts/hook/moodle-update-preparation.sh b/charts/dbp-moodle/scripts/hook/moodle-update-preparation.sh index 705957a..60be4db 100644 --- a/charts/dbp-moodle/scripts/hook/moodle-update-preparation.sh +++ b/charts/dbp-moodle/scripts/hook/moodle-update-preparation.sh @@ -4,12 +4,16 @@ set -o errexit set -o nounset set -o pipefail +health_file="/tmp/healthy" + get_current_deployment_image() { kubectl get "deploy/{{ .Release.Name }}" -n "{{ .Release.Namespace }}" -o jsonpath='{..image}' |\ tr -s '[:space:]' '\n' |\ grep '{{- .Values.moodle.image.repository -}}' } +touch "${health_file}" + printf "Checking if update preparations are needed\n" new_image="{{- .Values.moodle.image.registry -}}/{{- .Values.moodle.image.repository -}}:{{- .Values.moodle.image.tag -}}" diff --git a/charts/dbp-moodle/templates/chart-hooks/moodle-update-preparation-job.yaml b/charts/dbp-moodle/templates/chart-hooks/moodle-update-preparation-job.yaml index f710d22..b734eab 100644 --- a/charts/dbp-moodle/templates/chart-hooks/moodle-update-preparation-job.yaml +++ b/charts/dbp-moodle/templates/chart-hooks/moodle-update-preparation-job.yaml @@ -24,6 +24,13 @@ spec: - name: script-volume mountPath: /moodle-update-preparation.sh subPath: moodle-update-preparation.sh + livenessProbe: + exec: + command: + - cat + - /tmp/healthy + initialDelaySeconds: 10 + periodSeconds: 10 affinity: {{ .Values.dbpMoodle.moodleUpdatePreparationJob.affinity | toYaml }} tolerations: {{ .Values.dbpMoodle.moodleUpdatePreparationJob.tolerations | toYaml }} serviceAccountName: "{{ .Release.Name }}-moodle-update-preparation-hook-serviceaccount"