{{- if .Values.backup.enabled }}
{{- if and (.Values.backup.uploadProviders.google.enabled) (not .Values.backup.uploadProviders.google.existingSecret) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "influxdb.fullname" . }}-backup-gcloud
  labels:
    {{- include "influxdb.labels" . | nindent 4 }}
type: Opaque
data:
  {{ .Values.backup.uploadProviders.google.secretKey }}: {{ .Values.backup.uploadProviders.google.secret | b64enc | quote }}
{{- end }}
---
{{ if and (.Values.backup.uploadProviders.azure.enabled) (not .Values.backup.uploadProviders.azure.existingSecret) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "influxdb.fullname" . }}-backup-azure
  labels:
    {{- include "influxdb.labels" . | nindent 4 }}
type: Opaque
data:
  {{ .Values.backup.uploadProviders.azure.secretKey }}: {{ .Values.backup.uploadProviders.azure.secret | b64enc | quote }}
{{- end }}
{{- end }}
