Skip to content

Commit

Permalink
charts,salt: Set UID for grafana datasources
Browse files Browse the repository at this point in the history
Since in newer grafana version we need to use the datasource UID to
reference it, we explicitly set the datasource UID from ConfigMap so
that it's easier to reference them.

Re-render prometheus-operator 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 \
  --patch 'PrometheusRule,metalk8s-monitoring,prometheus-operator-kubernetes-system-kubelet,spec:groups:0:rules:1:for,"5m"' \
  > salt/metalk8s/addons/prometheus-operator/deployed/chart.sls
```
  • Loading branch information
TeddyAndrieux committed Jan 18, 2022
1 parent 06fa3a7 commit cbcf47f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
metalk8s-sosreport package compatible with sos version 4.0+
(PR[#3664](https://github.com/scality/metalk8s/pull/3664))

- Explicitly set the Grafana datasource UID to `metalk8s-<datasource_name>`
(PR[#3668](https://github.com/scality/metalk8s/pull/3668))

## Bug fixes

- [#3601](https://github.com/scality/metalk8s/issues/3601) - Marks
Expand Down
12 changes: 12 additions & 0 deletions charts/kube-prometheus-stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,20 @@ grafana:
foldersFromFilesStructure: true

datasources:
# NOTE: We do not deploy default datasource as we want to set UID
# and it's not possible using this template
defaultDatasourceEnabled: false

additionalDataSources:
- name: Prometheus
uid: metalk8s-prometheus
type: prometheus
access: proxy
isDefault: true
# Service deployed by Thanos
url: http://thanos-query-http:10902/
jsonData:
timeInterval: 30s

nodeSelector:
node-role.kubernetes.io/infra: ''
Expand Down
1 change: 1 addition & 0 deletions salt/metalk8s/addons/logging/loki/deployed/datasource.sls
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Deploy ConfigMap for Loki datasource:
apiVersion: 1
datasources:
- name: Loki
uid: metalk8s-loki
type: loki
access: proxy
url: http://loki.metalk8s-logging.svc.cluster.local:3100/
Expand Down
9 changes: 5 additions & 4 deletions salt/metalk8s/addons/prometheus-operator/deployed/chart.sls
Original file line number Diff line number Diff line change
Expand Up @@ -25089,13 +25089,14 @@ data:
datasource.yaml: |-
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://thanos-query-http:10902/
access: proxy
- access: proxy
isDefault: true
jsonData:
timeInterval: 30s
name: Prometheus
type: prometheus
uid: metalk8s-prometheus
url: http://thanos-query-http:10902/
kind: ConfigMap
metadata:
labels:
Expand Down

0 comments on commit cbcf47f

Please sign in to comment.