{{- if .Values.usePassword -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "mariadb.fullname" . }}
  labels:
    app: {{ template "mariadb.name" . }}
    chart: {{ template "mariadb.chart" . }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
type: Opaque
data:
  {{- if .Values.mariadbRootPassword }}
  mariadb-root-password: {{ .Values.mariadbRootPassword | b64enc | quote }}
  {{- else }}
  mariadb-root-password: {{ randAlphaNum 10 | b64enc | quote }}
  {{- end }}
  {{- if .Values.mariadbPassword }}
  mariadb-password: {{ .Values.mariadbPassword | b64enc | quote }}
  {{- else }}
  mariadb-password: {{ randAlphaNum 10 | b64enc | quote }}
  {{- end }}
{{- end -}}
