github.com/verrazzano/verrazzano@v1.7.0/platform-operator/helm_config/charts/verrazzano-grafana-dashboards/templates/configmaps.yaml (about)

     1  # Copyright (c) 2022, 2023, Oracle and/or its affiliates.
     2  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  {{- if .Values.enabled }}
     5  {{- $files := .Files.Glob "dashboards/**/*.json" }}
     6  {{- if $files }}
     7  apiVersion: v1
     8  kind: ConfigMapList
     9  items:
    10    {{- range $path, $_ :=  .Files.Glob  "**/*.json" }}
    11    {{- $fileName := base $path }}
    12    {{- $cmName := trimPrefix "dashboards/" $path | trimSuffix ".json" | replace "/" "-" | replace "_" "-" | replace " " "-" | lower }}
    13    {{- $subdir := trimSuffix $fileName $path | trimSuffix "/" | base }}
    14  # If Istio is disabled, skip deploying the Istio ConfigMaps
    15  {{- if or $.Values.istioEnabled (not (eq $subdir "Istio")) }}
    16  - apiVersion: v1
    17    kind: ConfigMap
    18    metadata:
    19      name: {{ $cmName }}
    20      namespace: {{ $.Values.namespace }}
    21      labels:
    22        {{ $.Values.dashboards.labelName }}: "{{ $.Values.dashboards.labelValue }}"
    23  {{- if $.Values.foldersFromFiles }}
    24  # the target subdir will determine the Grafana folder - trim off the file name and get the basename of the
    25  # directory of the JSON file in the Helm chart
    26      annotations:
    27        k8s-sidecar-target-directory: "{{ $subdir }}"
    28  {{- end }}
    29    data:
    30      {{ $fileName }}: |- {{ $.Files.Get $path | nindent 6 }}
    31  {{- end }}
    32  {{- end }}
    33  {{- end }}
    34  {{- end }}