{{- if .Values.grafanaDashboard.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "external-secrets.fullname" . }}-dashboard
  namespace: {{ include "external-secrets.namespace" . }}
  labels:
    {{ .Values.grafanaDashboard.sidecarLabel }}: {{ .Values.grafanaDashboard.sidecarLabelValue | quote }}
    {{- include "external-secrets.labels" . | nindent 4 }}
    {{- with .Values.grafanaDashboard.extraLabels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
  {{- with .Values.grafanaDashboard.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
data:
  external-secrets.json: {{ .Files.Get "files/monitoring/grafana-dashboard.json" | toJson }}
{{- end }}
