Commit 613bd675 authored by Jonathan S. Katz's avatar Jonathan S. Katz Committed by Jonathan S. Katz
Browse files

Add support for storing backups in Azure via Helm

This adds support both for a quickstart for storing backups in
Azure Blob Storage via the Helm chart, as well as multi-repo
support.
parent 0aff3be9
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
{{/* Allow for Azure secret information to be stored in a Secret */}}
{{- define "postgres.azure" }}
[global]
{{- if .azure }}
  {{- if .azure.account }}
repo{{ add .index 1 }}-azure-account={{ .azure.account }}
  {{- end }}
  {{- if .azure.key }}
repo{{ add .index 1 }}-azure-key={{ .azure.key }}
  {{- end }}
{{- end }}
{{ end }}
+9 −1
Original line number Diff line number Diff line
{{- if or .Values.multiBackupRepos .Values.s3 .Values.gcs }}
{{- if or .Values.multiBackupRepos .Values.s3 .Values.gcs .Values.azure }}
apiVersion: v1
kind: Secret
metadata:
@@ -17,6 +17,10 @@ data:
        {{ include "postgres.gcs" $args | b64enc }}
  gcs-key.json: |-
        {{ $repo.gcs.key | b64enc }}
  {{- else if $repo.azure }}
  {{- $args := dict "azure" $repo.azure "index" $index }}
  azure.conf: |-
        {{ include "postgres.azure" $args | b64enc }}
  {{- end }}
{{- end }}
{{- else if .Values.s3 }}
@@ -29,5 +33,9 @@ data:
        {{ include "postgres.gcs" $args | b64enc }}
  gcs-key.json: |-
        {{ .Values.gcs.key | b64enc }}
{{- else if .Values.azure }}
  {{- $args := dict "azure" .Values.azure "index" 0 }}
  azure.conf: |-
        {{ include "postgres.azure" $args | 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 or $repo.s3 $repo.gcs }}
        {{- if or $repo.s3 $repo.gcs $repo.azure }}
        repo{{ add $index 1 }}-path: /pgbackrest/{{ $.Release.Namespace }}/{{ default $.Release.Name $.Values.name }}/repo{{ add $index 1 }}
        {{- end }}
        {{- end }}
@@ -69,6 +69,9 @@ spec:
        {{- else if $repo.gcs }}
        gcs:
          bucket: {{ $repo.gcs.bucket | quote }}
        {{- else if $repo.azure }}
        azure:
          container: {{ $repo.azure.container | quote }}
        {{- end }}
      {{- end }}
{{- else if .Values.s3 }}
@@ -96,6 +99,16 @@ spec:
      - name: repo1
        gcs:
          bucket: {{ .Values.gcs.bucket | quote }}
{{- else if .Values.azure }}
      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
        azure:
          container: {{ .Values.azure.container | quote }}
{{- else }}
      repos:
      - name: repo1
+15 −0
Original line number Diff line number Diff line
@@ -200,6 +200,17 @@
#   key: |
#     {}

# azure allows for Azure Blob Storage to be used for backups. This allows
# for a quick setup with Azure Blob Storage; if you need a more advanced setup,
# use "pgBackRestConfig".
# azure:
#   # account is the name of the Azure account to be used.
#   account: ""
#   # key is the Secret key used associated with the Azure acount.
#   key: ""
#   # container is the Azure container that the backups will be stored in.
#   container: ""

# 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.
@@ -224,6 +235,10 @@
#     bucket: ""
#     key: |
#       {}
# - azure:
#     account: ""
#     key: ""
#     container: ""

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