Commit 0aff3be9 authored by Jonathan S. Katz's avatar Jonathan S. Katz Committed by Jonathan S. Katz
Browse files

Add support for backups to GCS via Helm chart

This adds both a quickstart for backing up to GCS as well as
use of GCS in a multi-repository setup.
parent d1ba873b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
{{/* Allow for GCS secret information to be stored in a Secret */}}
{{- define "postgres.gcs" }}
[global]
{{- if .gcs }}
repo{{ add .index 1 }}-gcs-key=/etc/pgbackrest/conf.d/gcs-key.json
{{- end }}
{{ end }}
+13 −1
Original line number Diff line number Diff line
{{- if or .Values.multiBackupRepos .Values.s3 }}
{{- if or .Values.multiBackupRepos .Values.s3 .Values.gcs }}
apiVersion: v1
kind: Secret
metadata:
@@ -11,11 +11,23 @@ data:
  {{- $args := dict "s3" $repo.s3 "index" $index }}
  s3.conf: |-
        {{ include "postgres.s3" $args | b64enc }}
  {{- else if $repo.gcs }}
  {{- $args := dict "gcs" $repo.gcs "index" $index }}
  gcs.conf: |-
        {{ include "postgres.gcs" $args | b64enc }}
  gcs-key.json: |-
        {{ $repo.gcs.key | b64enc }}
  {{- end }}
{{- end }}
{{- else if .Values.s3 }}
  {{- $args := dict "s3" .Values.s3 "index" 0 }}
  s3.conf: |-
        {{ include "postgres.s3" $args | b64enc }}
{{- else if .Values.gcs }}
  {{- $args := dict "gcs" .Values.gcs "index" 0 }}
  gcs.conf: |-
        {{ include "postgres.gcs" $args | b64enc }}
  gcs-key.json: |-
        {{ .Values.gcs.key | b64enc }}
{{- end }}
{{- end }}
+14 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ spec:
          name: {{ default .Release.Name .Values.name }}-pgbackrest-secret
      global:
        {{- range $index, $repo := .Values.multiBackupRepos }}
        {{- if $repo.s3 }}
        {{- if or $repo.s3 $repo.gcs }}
        repo{{ add $index 1 }}-path: /pgbackrest/{{ $.Release.Namespace }}/{{ default $.Release.Name $.Values.name }}/repo{{ add $index 1 }}
        {{- end }}
        {{- end }}
@@ -66,6 +66,9 @@ spec:
          bucket: {{ $repo.s3.bucket | quote }}
          endpoint: {{ $repo.s3.endpoint | quote }}
          region: {{ $repo.s3.region | quote }}
        {{- else if $repo.gcs }}
        gcs:
          bucket: {{ $repo.gcs.bucket | quote }}
        {{- end }}
      {{- end }}
{{- else if .Values.s3 }}
@@ -83,6 +86,16 @@ spec:
          bucket: {{ .Values.s3.bucket | quote }}
          endpoint: {{ .Values.s3.endpoint | quote }}
          region: {{ .Values.s3.region | quote }}
{{- else if .Values.gcs }}
      configuration:
      - secret:
          name: {{ default .Release.Name .Values.name }}-pgbackrest-secret
      global:
        repo1-path: /pgbackrest/{{ .Release.Namespace }}/{{ default .Release.Name .Values.name }}/repo1
      repos:
      - name: repo1
        gcs:
          bucket: {{ .Values.gcs.bucket | quote }}
{{- else }}
      repos:
      - name: repo1
+15 −0
Original line number Diff line number Diff line
@@ -189,6 +189,17 @@
#   # built-in encrpytion system.
#   encryptionPassphrase: ""

# gcs allows for Google Cloud Storage (GCS) to be used for backups. This allows
# for a quick setup with GCS; if you need a more advanced setup, use
# "pgBackRestConfig".
# gcs:
#   # bucket is the name of the GCS bucket that the backups will be stored in.
#   bucket: ""
#   # key is a multi-line string that contains the GCS key, which is a JSON
#   # structure.
#   key: |
#     {}

# multiBackupRepos allows for backing up to multiple repositories. This is
# effectively uses the "quickstarts" for each of the backup types (volume, s3,
# gcs, azure). You can have any permutation of these types. You can set up to 4.
@@ -209,6 +220,10 @@
#     region: ""
#     key: ""
#     keySecret: ""
# - gcs:
#     bucket: ""
#     key: |
#       {}

# pgBackRestConfig allows for the configuration of every pgBackRest option
# except for "image", which is set by "pgBackRest".