apiVersion: v1
kind: Secret
metadata:
  name: {{ template "mongodb.fullname" . }}
  labels:
    app: {{ template "mongodb.name" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
type: Opaque
data:
  {{ if and .Values.auth.enabled .Values.auth.rootPassword }}
  mongodb-root-password:  {{ .Values.auth.rootPassword | b64enc | quote }}
  {{ else }}
  mongodb-root-password: {{ randAlphaNum 10 | b64enc | quote }}
  {{ end }}
  mongodb-root-username: {{ .Values.auth.rootUsername | b64enc | quote }}
