{{- if and .Values.global.secret.create .Values.server.secret.create -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "chart.fullname" . }}-custom-user
  labels:
    app.kubernetes.io/component: server
    {{- include "chart.labels" . | nindent 4 }}
type: Opaque
data:
  {{- range $user, $password := .Values.server.readOnlyUsers }}
  PASSWORD_{{ $user | upper }}: {{ $password | b64enc | quote }}
  {{- end }}
  {{- range $user, $password := .Values.server.adminUsers }}
  PASSWORD_{{ $user | upper }}: {{ $password | b64enc | quote }}
  {{- end }}
{{- end -}}
