Add direct url restore.
Showing
2 changed files
with
14 additions
and
3 deletions
... | @@ -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 | ... | ... |
-
Please register or sign in to post a comment