{{- if or .Values.multiBackupRepos .Values.s3 .Values.gcs .Values.azure }} apiVersion: v1 kind: Secret metadata: name: {{ default .Release.Name .Values.name }}-pgbackrest-secret type: Opaque data: {{- if .Values.multiBackupRepos }} {{- range $index, $repo := .Values.multiBackupRepos }} {{- if $repo.s3 }} {{- $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 }} {{- else if $repo.azure }} {{- $args := dict "azure" $repo.azure "index" $index }} azure.conf: |- {{ include "postgres.azure" $args | 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 }} {{- else if .Values.azure }} {{- $args := dict "azure" .Values.azure "index" 0 }} azure.conf: |- {{ include "postgres.azure" $args | b64enc }} {{- end }} {{- end }}