# helm_charts_mongodb-metrics-secret.yaml
{{- if and (.Values.auth.enabled) (not .Values.auth.existingMetricsSecret) (.Values.metrics.enabled) -}}
apiVersion: v1
kind: Secret
metadata:
  labels:
    app: {{ template "mongodb-replicaset.name" . }}
    chart: {{ template "mongodb-replicaset.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
{{- if .Values.extraLabels }}
{{ toYaml .Values.extraLabels | indent 4 }}
{{- end }}
{{- if .Values.secretAnnotations }}
  annotations:
{{ toYaml .Values.secretAnnotations | indent 4 }}
{{- end }}
  name: {{ template "mongodb-replicaset.metricsSecret" . }}
  namespace: {{ template "mongodb-replicaset.namespace" . }}
type: Opaque
data:
  user: {{ .Values.auth.metricsUser | b64enc }}
  password: {{ .Values.auth.metricsPassword | b64enc }}
{{- end -}}