From ccfb3d0417487adcb327fb1e6ddf4073dd0a2e49 Mon Sep 17 00:00:00 2001 From: Nik Voss Date: Tue, 19 Feb 2019 14:04:59 +0100 Subject: [PATCH] Fixed configmap dashboard problems, when no custom files are provided. (#11034) Signed-off-by: Niklas Voss --- stable/prometheus-operator/Chart.yaml | 2 +- .../templates/grafana/configmap-dashboards.yaml | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/stable/prometheus-operator/Chart.yaml b/stable/prometheus-operator/Chart.yaml index b1ff65dc7c..ec6ab495a1 100644 --- a/stable/prometheus-operator/Chart.yaml +++ b/stable/prometheus-operator/Chart.yaml @@ -9,7 +9,7 @@ name: prometheus-operator sources: - https://github.com/coreos/prometheus-operator - https://coreos.com/operators/prometheus -version: 2.2.6 +version: 2.2.7 appVersion: 0.26.0 home: https://github.com/coreos/prometheus-operator keywords: diff --git a/stable/prometheus-operator/templates/grafana/configmap-dashboards.yaml b/stable/prometheus-operator/templates/grafana/configmap-dashboards.yaml index 2eab290256..0289154b9f 100644 --- a/stable/prometheus-operator/templates/grafana/configmap-dashboards.yaml +++ b/stable/prometheus-operator/templates/grafana/configmap-dashboards.yaml @@ -1,8 +1,10 @@ {{- if and .Values.grafana.enabled .Values.grafana.defaultDashboardsEnabled }} +{{- $files := .Files.Glob "dashboards/*.json" }} +{{- if $files }} apiVersion: v1 kind: ConfigMapList items: -{{- range $path, $fileContents := .Files.Glob "dashboards/*.json" }} +{{- range $path, $fileContents := $files }} {{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }} - apiVersion: v1 kind: ConfigMap @@ -17,4 +19,5 @@ items: data: {{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} +{{- end }}