github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/helm/templates/grafana/configmap-dashboards.yaml (about)

     1  {{- if .Values.grafana.sidecar.dashboards.enabled }}
     2  {{- $files := .Files.Glob "dashboards/*.json" }}
     3  {{- if $files }}
     4  apiVersion: v1
     5  kind: ConfigMapList
     6  items:
     7  {{- range $path, $fileContents := $files }}
     8  {{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }}
     9  - apiVersion: v1
    10    kind: ConfigMap
    11    metadata:
    12      name: {{ printf "%s-grafana-%s" (include "kubeblocks.fullname" $) $dashboardName | trunc 63 | trimSuffix "-" }}
    13      namespace: {{ template "kubeblocks.grafana.namespace" $ }}
    14      labels:
    15        {{- if $.Values.grafana.sidecar.dashboards.label }}
    16        {{ $.Values.grafana.sidecar.dashboards.label }}: {{ ternary $.Values.grafana.sidecar.dashboards.labelValue "1" (not (empty $.Values.grafana.sidecar.dashboards.labelValue)) | quote }}
    17        {{- end }}
    18        app: {{ template "kubeblocks.name" $ }}-grafana
    19  {{ include "kubeblocks.labels" $ | indent 6 }}
    20    data:
    21      {{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
    22  {{- end }}
    23  {{- end }}
    24  {{- end }}