{{- if .Values.metrics.dashboards.create }}
{{- $namespace := .Values.metrics.dashboards.namespace | default $.Release.Namespace }}
{{- range $path, $_ :=  .Files.Glob  "dashboards/*.json" }}
{{- $filename := trimSuffix (ext $path) (base $path) }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ printf "%s-%s" (include "sealed-secrets.fullname" $) $filename }}
  namespace: {{ $namespace }}
  labels: {{- include "sealed-secrets.labels" $ | nindent 4 }}
    {{- if $.Values.metrics.dashboards.labels }}
    {{- include "sealed-secrets.render" ( dict "value" $.Values.metrics.dashboards.labels "context" $) | nindent 4 }}
    {{- end }}
data:
  {{ base $path }}: |-
{{ $.Files.Get $path | indent 4 }}
---
{{- end }}
{{- end }}
