From 88030820f89ecbdeeefce932b0ad12142c479d54 Mon Sep 17 00:00:00 2001 From: Jordi Bertran de Balanda Date: Tue, 30 Nov 2021 11:42:08 +0100 Subject: [PATCH] salt,charts: Grafana sidecar picks up dashboards in all namespaces Configure k8s-sidecar in Grafana deployment: * to search in `ALL` namespaces * to place dashboards in folders according to `metalk8s.scality.com/grafana-folder-name` annotation * to create Grafana folders from dashboard directory structure Re-render chart to salt state using ``` ./charts/render.py prometheus-operator \ charts/kube-prometheus-stack.yaml \ charts/kube-prometheus-stack/ \ --namespace metalk8s-monitoring \ --service-config grafana \ metalk8s-grafana-config \ metalk8s/addons/prometheus-operator/config/grafana.yaml \ metalk8s-monitoring \ --service-config prometheus \ metalk8s-prometheus-config \ metalk8s/addons/prometheus-operator/config/prometheus.yaml \ metalk8s-monitoring \ --service-config alertmanager \ metalk8s-alertmanager-config \ metalk8s/addons/prometheus-operator/config/alertmanager.yaml \ metalk8s-monitoring \ --service-config dex \ metalk8s-dex-config \ metalk8s/addons/dex/config/dex.yaml.j2 metalk8s-auth \ --drop-prometheus-rules charts/drop-prometheus-rules.yaml \ > salt/metalk8s/addons/prometheus-operator/deployed/chart.sls ``` Fixes: #3618 --- .../kube-prometheus-stack/charts/grafana/values.yaml | 6 +++--- .../addons/prometheus-operator/deployed/chart.sls | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/charts/kube-prometheus-stack/charts/grafana/values.yaml b/charts/kube-prometheus-stack/charts/grafana/values.yaml index 5045231fe9..9b2750cc2b 100644 --- a/charts/kube-prometheus-stack/charts/grafana/values.yaml +++ b/charts/kube-prometheus-stack/charts/grafana/values.yaml @@ -630,12 +630,12 @@ sidecar: # If specified, the sidecar will search for dashboard config-maps inside this namespace. # Otherwise the namespace in which the sidecar is running will be used. # It's also possible to specify ALL to search in all namespaces - searchNamespace: null + searchNamespace: ALL # search in configmap, secret or both resource: both # If specified, the sidecar will look for annotation with this name to create folder and put graph here. # You can use this parameter together with `provider.foldersFromFilesStructure`to annotate configmaps and create folder structure. - folderAnnotation: null + folderAnnotation: metalk8s.scality.com/grafana-folder-name # provider configuration that lets grafana manage the dashboards provider: # name of the provider, should be unique @@ -651,7 +651,7 @@ sidecar: # allow updating provisioned dashboards from the UI allowUiUpdates: false # allow Grafana to replicate dashboard structure from filesystem - foldersFromFilesStructure: false + foldersFromFilesStructure: true datasources: enabled: false # label that the configmaps with datasources are marked with diff --git a/salt/metalk8s/addons/prometheus-operator/deployed/chart.sls b/salt/metalk8s/addons/prometheus-operator/deployed/chart.sls index 2b982abb95..1a481081c8 100644 --- a/salt/metalk8s/addons/prometheus-operator/deployed/chart.sls +++ b/salt/metalk8s/addons/prometheus-operator/deployed/chart.sls @@ -20796,13 +20796,12 @@ data: providers: - name: 'sidecarProvider' orgId: 1 - folder: '' type: file disableDeletion: false allowUiUpdates: false updateIntervalSeconds: 30 options: - foldersFromFilesStructure: false + foldersFromFilesStructure: true path: /tmp/dashboards kind: ConfigMap metadata: @@ -57480,7 +57479,7 @@ spec: apiVersion="v1", namespace="metalk8s-monitoring", name="prometheus-operator-grafana", path="data:grafana.ini") checksum/dashboards-json-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b - checksum/sc-dashboard-provider-config: 1fb938ae203ab04abaec138541fafa99df99f419c7c1567c8573f1cb0e9a487c + checksum/sc-dashboard-provider-config: 015250c97b5d357b599e212313ae96228466291847f8918b64b2a2ade947b8a7 checksum/secret: 81a974a3dea4b80cdc27cccd08b7648f4175ec54526ce15faffd35b6535e0967 labels: app.kubernetes.io/instance: prometheus-operator @@ -57496,6 +57495,10 @@ spec: value: /tmp/dashboards - name: RESOURCE value: both + - name: NAMESPACE + value: ALL + - name: FOLDER_ANNOTATION + value: metalk8s.scality.com/grafana-folder-name image: {% endraw -%}{{ build_image_name("k8s-sidecar", False) }}{%- raw %}:1.12.2 imagePullPolicy: IfNotPresent name: grafana-sc-dashboard @@ -59893,7 +59896,7 @@ spec: expr: (kube_node_spec_taint{job="kube-state-metrics",key="node.kubernetes.io/unreachable",effect="NoSchedule"} unless ignoring(key,value) kube_node_spec_taint{job="kube-state-metrics",key=~"ToBeDeletedByClusterAutoscaler|cloud.google.com/impending-node-termination|aws-node-termination-handler/spot-itn"}) == 1 - for: 5m + for: 15m labels: severity: warning - alert: KubeletTooManyPods