{{- if .Values.mysql.customUsers }}
apiVersion: v1
kind: Secret
metadata:
  name: deploykf-mysql-custom-users
  labels:
    helm.sh/chart: {{ include "deploykf-mysql.labels.chart" . }}
    app.kubernetes.io/name: {{ include "deploykf-mysql.labels.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/component: mysql
data:
  {{- range $index, $user := .Values.mysql.customUsers }}
  {{- if not $user.existingSecret }}
  {{ printf "%d_username" $index | quote }}: {{ $user.username | b64enc | quote }}
  {{ printf "%d_password" $index | quote }}: {{ $user.password | b64enc | quote }}
  {{- end }}
  {{- end }}
{{- end }}