{{- if .Values.mysql.password }}
apiVersion: v1
kind: Secret
metadata:
  name: "{{ template "mysqldump.fullname" . }}"
  labels:
    app.kubernetes.io/name: {{ include "mysqldump.name" . }}
    helm.sh/chart: {{ include "mysqldump.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
type: Opaque
data:
  MYSQL_PASSWORD: {{ .Values.mysql.password | b64enc | quote }}
---
{{- end }}
{{- if .Values.upload.ssh.enabled }}
apiVersion: v1
kind: Secret
metadata:
  name: "{{ template "mysqldump.fullname" . }}-ssh-privatekey"
  labels:
    app.kubernetes.io/name: {{ include "mysqldump.name" . }}
    helm.sh/chart: {{ include "mysqldump.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
type: Opaque
stringData:
  id_rsa: {{ .Values.upload.ssh.privatekey | quote }}
---
{{- end }}
{{- if .Values.upload.googlestoragebucket.enabled }}
{{- if not .Values.upload.googlestoragebucket.existingSecret }}
{{- if not .Values.upload.googlestoragebucket.usingGCPController }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "mysqldump.gcpsecretName" . }}
  labels:
    app.kubernetes.io/name: {{ include "mysqldump.name" . }}
    helm.sh/chart: {{ include "mysqldump.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
type: Opaque
stringData:
  {{ .Values.upload.googlestoragebucket.secretFileName }}: {{ .Values.upload.googlestoragebucket.jsonKeyfile | quote }}
{{ end }}
{{ end }}
{{ end }}