228aef4c by Adam Heath

Add direct url restore.

1 parent 09de0410
...@@ -53,15 +53,21 @@ spec: ...@@ -53,15 +53,21 @@ spec:
53 name: {{ include "postgresql-rclone.fullname" . }}-rclone 53 name: {{ include "postgresql-rclone.fullname" . }}-rclone
54 - secretRef: 54 - secretRef:
55 name: {{ include "postgresql-rclone.fullname" . }}-rclone 55 name: {{ include "postgresql-rclone.fullname" . }}-rclone
56 {{- if .Values.rclone.crypt.enabled }}
57 env: 56 env:
57 {{- if .Values.rclone.crypt.enabled }}
58 - name: RCLONE_CRYPT_REMOTE 58 - name: RCLONE_CRYPT_REMOTE
59 {{- else }}
60 - name: RCLONE_S3_REMOTE
61 {{- end }}
62 {{- if .Values.restore.url }}
63 value: ":{{ .Values.restore.url }}"
64 {{- else }}
59 value: ":s3:$(S3_BUCKET)/$(S3_PREFIX)/last/" 65 value: ":s3:$(S3_BUCKET)/$(S3_PREFIX)/last/"
60 {{- end }} 66 {{- end }}
61 {{- if .Values.rclone.crypt.enabled }} 67 {{- if .Values.rclone.crypt.enabled }}
62 args: ["copy", ":crypt:", "/restores/"] 68 args: ["copy", ":crypt:", "/restores/.work/"]
63 {{- else }} 69 {{- else }}
64 args: ["-v", "copy", ":s3:$(S3_BUCKET)/$(S3_PREFIX)/last/", "/restores/.work/"] 70 args: ["-v", "copy", "$(RCLONE_S3_REMOTE)", "/restores/.work/"]
65 {{- end }} 71 {{- end }}
66 {{- end }} 72 {{- end }}
67 - name: link-latest 73 - name: link-latest
...@@ -74,9 +80,13 @@ spec: ...@@ -74,9 +80,13 @@ spec:
74 - bash 80 - bash
75 - -cx 81 - -cx
76 - |- 82 - |-
83 {{- if .Values.restore.url }}
84 find /restores/.work -maxdepth 1 -mindepth 1 | \
85 {{- else }}
77 find /restores/.work -maxdepth 1 -mindepth 1 -name '*.sql.gz' | \ 86 find /restores/.work -maxdepth 1 -mindepth 1 -name '*.sql.gz' | \
78 sort | \ 87 sort | \
79 awk '{split($1, a, /-([^-]*)-([^-]*)$/)} !uniq[a[1] a[2] a[3]]++' | \ 88 awk '{split($1, a, /-([^-]*)-([^-]*)$/)} !uniq[a[1] a[2] a[3]]++' | \
89 {{- end }}
80 while read file; do \ 90 while read file; do \
81 ln -f "$file" "/restores/" 91 ln -f "$file" "/restores/"
82 done 92 done
......
...@@ -36,6 +36,7 @@ backup: ...@@ -36,6 +36,7 @@ backup:
36 size: 10Gi 36 size: 10Gi
37 37
38 restore: 38 restore:
39 url: ""
39 job: 40 job:
40 ttlSecondsAfterFinished: 60 41 ttlSecondsAfterFinished: 60
41 pvc: 42 pvc:
......