From 5a290e1d8367f9dad9e87aadc1904af56afc06a4 Mon Sep 17 00:00:00 2001 From: "Lo, Chi (cl566n)" Date: Mon, 2 Aug 2021 12:31:43 -0700 Subject: [PATCH] Add Alertmanager dashboard to Grafana This patch set adds a new Alertmanager dashboard to Grafana. Note that a new configmap is created for this instead of using the same configmap which includes all the dashboards. Using the same configmap will eventually run into issue with configmap size limitation. Change-Id: I10561c0b0b464c3b67d4a738f9f2cb70ef601b3d --- grafana/Chart.yaml | 2 +- .../configmap-dashboards-alertmanager.yaml | 25 +++++++++++++++++++ grafana/templates/deployment.yaml | 13 ++++++++++ grafana/values.yaml | 2 ++ releasenotes/notes/grafana.yaml | 1 + 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 grafana/templates/configmap-dashboards-alertmanager.yaml diff --git a/grafana/Chart.yaml b/grafana/Chart.yaml index 08b90ce91..ed808766a 100644 --- a/grafana/Chart.yaml +++ b/grafana/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v7.4.5 description: OpenStack-Helm Grafana name: grafana -version: 0.1.8 +version: 0.1.9 home: https://grafana.com/ sources: - https://github.com/grafana/grafana diff --git a/grafana/templates/configmap-dashboards-alertmanager.yaml b/grafana/templates/configmap-dashboards-alertmanager.yaml new file mode 100644 index 000000000..e27ab6ba1 --- /dev/null +++ b/grafana/templates/configmap-dashboards-alertmanager.yaml @@ -0,0 +1,25 @@ +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.configmap_dashboards_alertmanager }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: grafana-dashboards-alertmanager +data: +{{ range $key, $value := .Values.conf.dashboards_alertmanager }} + {{$key}}.json: {{ $value | toJson }} +{{ end }} +{{- end }} diff --git a/grafana/templates/deployment.yaml b/grafana/templates/deployment.yaml index c04fff3a0..8db22f160 100644 --- a/grafana/templates/deployment.yaml +++ b/grafana/templates/deployment.yaml @@ -125,6 +125,13 @@ spec: mountPath: /etc/grafana/dashboards/{{$key}}.json subPath: {{$key}}.json {{- end }} +{{- if .Values.manifests.configmap_dashboards_alertmanager }} + {{- range $key, $value := .Values.conf.dashboards_alertmanager }} + - name: grafana-dashboards-alertmanager + mountPath: /etc/grafana/dashboards/{{$key}}.json + subPath: {{$key}}.json + {{- end }} +{{- end }} {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} {{ if $mounts_grafana.volumeMounts }}{{ toYaml $mounts_grafana.volumeMounts | indent 12 }}{{ end }} volumes: @@ -150,6 +157,12 @@ spec: configMap: name: grafana-dashboards defaultMode: 0555 +{{- if .Values.manifests.configmap_dashboards_alertmanager }} + - name: grafana-dashboards-alertmanager + configMap: + name: grafana-dashboards-alertmanager + defaultMode: 0555 +{{- end }} - name: data emptyDir: {} {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} diff --git a/grafana/values.yaml b/grafana/values.yaml index aaa9eb6ac..56b42c911 100644 --- a/grafana/values.yaml +++ b/grafana/values.yaml @@ -367,6 +367,7 @@ manifests: configmap_bin: true configmap_etc: true configmap_dashboards: true + configmap_dashboards_alertmanager: false deployment: true ingress: true helm_tests: true @@ -485,4 +486,5 @@ conf: grafana_net: url: https://grafana.net dashboards: {} + dashboards_alertmanager: {} ... diff --git a/releasenotes/notes/grafana.yaml b/releasenotes/notes/grafana.yaml index 3bc57528d..b6735b5e6 100644 --- a/releasenotes/notes/grafana.yaml +++ b/releasenotes/notes/grafana.yaml @@ -9,4 +9,5 @@ grafana: - 0.1.6 Enable TLS for Grafana ingress path - 0.1.7 Update Grafana version and Selenium script - 0.1.8 Use full image ref for docker official images + - 0.1.9 Add Alertmanager dashboard to Grafana ...