{{- range $name, $u := .Values.users }}
{{ if not (eq $name "root") }}
{{ $dnsName := replace "_" "-" $name }}
---
apiVersion: k8s.mariadb.com/v1alpha1
kind: User
metadata:
  name: {{ $.Release.Name }}-{{ $dnsName }}
spec:
  name: {{ $name }}
  mariaDbRef:
    name: {{ $.Release.Name }}
  passwordSecretKeyRef:
    name: {{ $.Release.Name }}-credentials
    key: {{ $name }}
  maxUserConnections: {{ $u.maxUserConnections }}
{{- end }}
{{- end }}
