228aef4c by Adam Heath

Add direct url restore.

1 parent 09de0410
......@@ -53,15 +53,21 @@ spec:
name: {{ include "postgresql-rclone.fullname" . }}-rclone
- secretRef:
name: {{ include "postgresql-rclone.fullname" . }}-rclone
{{- if .Values.rclone.crypt.enabled }}
env:
{{- if .Values.rclone.crypt.enabled }}
- name: RCLONE_CRYPT_REMOTE
{{- else }}
- name: RCLONE_S3_REMOTE
{{- end }}
{{- if .Values.restore.url }}
value: ":{{ .Values.restore.url }}"
{{- else }}
value: ":s3:$(S3_BUCKET)/$(S3_PREFIX)/last/"
{{- end }}
{{- if .Values.rclone.crypt.enabled }}
args: ["copy", ":crypt:", "/restores/"]
args: ["copy", ":crypt:", "/restores/.work/"]
{{- else }}
args: ["-v", "copy", ":s3:$(S3_BUCKET)/$(S3_PREFIX)/last/", "/restores/.work/"]
args: ["-v", "copy", "$(RCLONE_S3_REMOTE)", "/restores/.work/"]
{{- end }}
{{- end }}
- name: link-latest
......@@ -74,9 +80,13 @@ spec:
- bash
- -cx
- |-
{{- if .Values.restore.url }}
find /restores/.work -maxdepth 1 -mindepth 1 | \
{{- else }}
find /restores/.work -maxdepth 1 -mindepth 1 -name '*.sql.gz' | \
sort | \
awk '{split($1, a, /-([^-]*)-([^-]*)$/)} !uniq[a[1] a[2] a[3]]++' | \
{{- end }}
while read file; do \
ln -f "$file" "/restores/"
done
......
......@@ -36,6 +36,7 @@ backup:
size: 10Gi
restore:
url: ""
job:
ttlSecondsAfterFinished: 60
pvc:
......