From 5d8801a4a49b7e156ff4f89aae4199468bf748d8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 23 Nov 2024 16:03:27 +0100 Subject: [PATCH] Update: monitoring mixins set to v1.12.0 for coredns-mixin (#932) Signed-off-by: Nicolas Lamirault Co-authored-by: Nicolas Lamirault --- charts/coredns-mixin/Chart.yaml | 4 +-- charts/coredns-mixin/dashboards/coredns.json | 2 +- charts/coredns-mixin/templates/alerts.yaml | 3 ++ .../templates/configmap-dashboards.yaml | 36 ++++++++++++++++--- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/charts/coredns-mixin/Chart.yaml b/charts/coredns-mixin/Chart.yaml index 46c77c7f..4de69090 100644 --- a/charts/coredns-mixin/Chart.yaml +++ b/charts/coredns-mixin/Chart.yaml @@ -28,7 +28,7 @@ keywords: - prometheus - monitoring-mixin - portefaix -version: 1.4.1 +version: 1.5.0 appVersion: master maintainers: @@ -53,4 +53,4 @@ annotations: url: https://keybase.io/nlamirault/pgp_keys.asc artifacthub.io/changes: | - kind: changed - description: clean dashboards + description: coredns-mixin vmaster diff --git a/charts/coredns-mixin/dashboards/coredns.json b/charts/coredns-mixin/dashboards/coredns.json index 60d463b7..94c3bd54 100644 --- a/charts/coredns-mixin/dashboards/coredns.json +++ b/charts/coredns-mixin/dashboards/coredns.json @@ -1397,7 +1397,7 @@ "style": "dark", "tags": [ "coredns-mixin", - "monitoring-mixins-v1.6.0" + "monitoring-mixins-v1.12.0" ], "templating": { "list": [ diff --git a/charts/coredns-mixin/templates/alerts.yaml b/charts/coredns-mixin/templates/alerts.yaml index 9ad63a3d..685dd448 100644 --- a/charts/coredns-mixin/templates/alerts.yaml +++ b/charts/coredns-mixin/templates/alerts.yaml @@ -1,3 +1,4 @@ +{{ if .Values.monitor.enabled -}} --- apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule @@ -8,6 +9,7 @@ metadata: {{- include "coredns-mixin.annotations" . | indent 4 }} labels: {{- include "coredns-mixin.labels" . | indent 4 }} + app.kubernetes.io/component: metrics {{- if .Values.monitor.additionalLabels }} {{- toYaml .Values.monitor.additionalLabels | nindent 4 }} {{- end }} @@ -115,3 +117,4 @@ spec: for: 10m labels: severity: warning +{{- end }} diff --git a/charts/coredns-mixin/templates/configmap-dashboards.yaml b/charts/coredns-mixin/templates/configmap-dashboards.yaml index ac1178af..8493826f 100644 --- a/charts/coredns-mixin/templates/configmap-dashboards.yaml +++ b/charts/coredns-mixin/templates/configmap-dashboards.yaml @@ -1,24 +1,50 @@ ---- +{{ if .Values.grafanaDashboard.enabled -}} {{- $files := .Files.Glob "dashboards/*.json" }} {{- if $files }} +--- apiVersion: v1 kind: ConfigMapList items: {{- range $path, $fileContents := $files }} -{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }} +{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" | lower }} - apiVersion: v1 kind: ConfigMap metadata: - name: {{ printf "dashboard-coredns-mixin-%s" $dashboardName | trunc 63 | trimSuffix "-" }} - namespace: {{ include "coredns-mixin.namespace" $ }} annotations: - grafana-folder: {{ $.Values.grafana.folder }} + grafana-folder: {{ $.Values.grafanaDashboard.folder }} {{- include "coredns-mixin.annotations" $ | indent 6 }} labels: grafana-dashboard: {{ $dashboardName }} {{- include "coredns-mixin.labels" $ | indent 6 }} + app.kubernetes.io/component: dashboard + name: {{ printf "dashboard-%s" $dashboardName | trunc 63 | trimSuffix "-" }} + namespace: {{ include "coredns-mixin.namespace" $ }} data: {{ $dashboardName }}.json: |- {{ $.Files.Get $path | indent 6}} {{- end }} +{{ if $.Values.grafanaDashboard.grafanaOperator.enabled -}} +{{- range $path, $fileContents := $files }} +{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }} +--- +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDashboard +metadata: + labels: + {{- include "coredns-mixin.labels" $ | indent 4 }} + app.kubernetes.io/component: dashboard + name: {{ printf "%s" $dashboardName | trunc 63 | trimSuffix "-" | lower }} + namespace: {{ $.Release.Namespace }} +spec: + allowCrossNamespaceImport: {{ $.Values.grafanaDashboard.grafanaOperator.allowCrossNamespaceImport }} + folder: {{ $.Values.grafanaDashboard.folder }} + instanceSelector: + matchLabels: + {{- toYaml $.Values.grafanaDashboard.grafanaOperator.matchLabels | nindent 6 }} + configMapRef: + name: {{ printf "dashboard-%s" $dashboardName | trunc 63 | trimSuffix "-" }} + key: {{ $dashboardName }}.json +{{- end }} +{{- end }} +{{- end }} {{- end }}