{{- if not .Values.existingSecret.name -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "prometheus-mongodb-exporter.secretName" . }}
  labels:
    app.kubernetes.io/name: {{ include "prometheus-mongodb-exporter.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    helm.sh/chart: {{ include "prometheus-mongodb-exporter.chart" . }}
type: Opaque
data:
  {{ .Values.existingSecret.key }} : {{ required "A MongoDB URI is required" .Values.mongodb.uri | b64enc }}
{{- end -}}
