apiVersion: v1
kind: Secret
metadata:
  name: {{ template "fullname" . }}
  labels:
    app: {{ template "fullname" . }}
    chart: "{{ template "mysqlha.chart" . }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
type: Opaque
data:
  {{- if .Values.mysqlha.mysqlRootPassword }}
  mysql-root-password: {{ .Values.mysqlha.mysqlRootPassword | b64enc | quote }}
  {{- else }}
  mysql-root-password: {{ randAlphaNum 12 | b64enc | quote }}
  {{- end }}
  {{- if .Values.mysqlha.mysqlUser }}
  {{- if .Values.mysqlha.mysqlPassword }}
  mysql-password: {{ .Values.mysqlha.mysqlPassword | b64enc | quote }}
  {{- else }}
  mysql-password: {{ randAlphaNum 12 | b64enc | quote }}
  {{- end }}
  {{- end }}
  {{- if .Values.mysqlha.mysqlReplicationPassword }}
  mysql-replication-password: {{ .Values.mysqlha.mysqlReplicationPassword | b64enc | quote }}
  {{- else }}
  mysql-replication-password: {{ randAlphaNum 12 | b64enc | quote }}
  {{- end }}
