29648c05 by Adam Heath

Attempt to deal with failures during restore.

Refs: #BF-11765
1 parent 74f46752
...@@ -37,6 +37,17 @@ spec: ...@@ -37,6 +37,17 @@ spec:
37 name: {{ include "postgresql-rclone.fullname" . }}-rclone 37 name: {{ include "postgresql-rclone.fullname" . }}-rclone
38 {{- end }} 38 {{- end }}
39 initContainers: 39 initContainers:
40 - name: cleanup-pvc
41 image: "{{ .Values.bash.image.repository }}:{{ .Values.bash.image.tag }}"
42 imagePullPolicy: {{ .Values.bash.image.pullPolicy }}
43 volumeMounts:
44 - name: restores
45 mountPath: /restores
46 command:
47 - bash
48 - -cx
49 - |-
50 find /restores -delete
40 {{- if .Values.rclone.enabled }} 51 {{- if .Values.rclone.enabled }}
41 - name: rclone 52 - name: rclone
42 image: "{{ .Values.rclone.image.repository }}:{{ .Values.rclone.image.tag }}" 53 image: "{{ .Values.rclone.image.repository }}:{{ .Values.rclone.image.tag }}"
...@@ -112,6 +123,8 @@ spec: ...@@ -112,6 +123,8 @@ spec:
112 - bash 123 - bash
113 - -cx 124 - -cx
114 - |- 125 - |-
126 set -- /restores/*
127 [[ -e $1 ]] || touch /restores/.error
115 touch /restores/.restored 128 touch /restores/.restored
116 129
117 130
......
...@@ -47,6 +47,8 @@ releases: ...@@ -47,6 +47,8 @@ releases:
47 until [ -f /docker-entrypoint-initdb.d/.restored ]; do 47 until [ -f /docker-entrypoint-initdb.d/.restored ]; do
48 sleep 5 48 sleep 5
49 done 49 done
50 if [ -f /docker-entrypoint-initdb.d/.error ]; then exit 1; fi
51
50 {{- range (.Values | get "primary.initContainers" list) }} 52 {{- range (.Values | get "primary.initContainers" list) }}
51 - {{ . | toYaml | nindent 14 }} 53 - {{ . | toYaml | nindent 14 }}
52 {{- end }} 54 {{- end }}
......