Skip to content

Commit

Permalink
salt,charts: Grafana sidecar picks up dashboards in all namespaces
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jordi Bertran de Balanda committed Dec 3, 2021
1 parent bef4690 commit 8803082
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions charts/kube-prometheus-stack/charts/grafana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 7 additions & 4 deletions salt/metalk8s/addons/prometheus-operator/deployed/chart.sls
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8803082

Please sign in to comment.