From 43863bf8fa3de52ee3e86e98a1a974aff5ab01e9 Mon Sep 17 00:00:00 2001 From: Nacho Barrientos <nacho.barrientos@cern.ch> Date: Wed, 23 Oct 2024 11:58:24 +0200 Subject: [PATCH] prometheus-server: honour metrics.prometheus.server.extraLabelsForMetrics Author: Nacho Barrientos <nacho.barrientos@cern.ch> --- docs/values.md | 4 ++-- templates/prometheus/prometheus.yaml | 3 +++ values.yaml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/values.md b/docs/values.md index 7e265bd..3d70382 100644 --- a/docs/values.md +++ b/docs/values.md @@ -56,7 +56,7 @@ This file contains the markdown version of the default values that this chart ta | metrics.prometheus.operator | object | Resources configuration. See `values.yaml`. | specific configuration for the prometheus operator | | metrics.prometheus.operator.nodeSelector | hash | `"nil"` | prometheus operator node selectors | | metrics.prometheus.server.nodeSelector | hash | `"nil"` | prometheus server node selectors | -| metrics.prometheus.server.extraLabelsForMetrics | list | `[]` | set of static labels and values to add to all the metrics gathered by the in-cluster prometheus when exported to central monitoring | +| metrics.prometheus.server.extraLabelsForMetrics | hash | `{}` | set of static labels and values to add to all the metrics gathered by the in-cluster prometheus when exported to central monitoring | | metrics.prometheus.server.remoteWrite | object | `{}` | remote write prometheus configuration | | metrics.prometheus.server.resources.limits.cpu | string | `"500m"` | | | metrics.prometheus.server.resources.limits.memory | string | `"5Gi"` | | @@ -72,4 +72,4 @@ This file contains the markdown version of the default values that this chart ta | tenant.name | string | `"nil"` | username used for authenitcating in the MONIT infrastructure | | tenant.password | string | `"nil"` | password (plain) used for authenitcating in the MONIT infrastructure | ----------------------------------------------- \ No newline at end of file +---------------------------------------------- diff --git a/templates/prometheus/prometheus.yaml b/templates/prometheus/prometheus.yaml index 9bc348b..83cd97f 100644 --- a/templates/prometheus/prometheus.yaml +++ b/templates/prometheus/prometheus.yaml @@ -12,6 +12,9 @@ spec: retention: {{ .Values.metrics.prometheus.server.retention }} externalLabels: k8s_cluster_name: {{ .Values.kubernetes.clusterName }} + {{- with .Values.metrics.prometheus.server.extraLabelsForMetrics }} + {{- toYaml . | nindent 4 }} + {{- end }} nodeSelector: {{- .Values.metrics.prometheus.server.nodeSelector | default .Values.metrics.defaultNodeSelector | toYaml | nindent 4 }} serviceAccountName: it-monit-metrics-collector-prometheus diff --git a/values.yaml b/values.yaml index e9dc25b..a7d05c0 100644 --- a/values.yaml +++ b/values.yaml @@ -88,7 +88,7 @@ metrics: # -- interval during which local cluster prometheus will store metrics retention: "24h" # -- set of static labels and values to add to all the metrics gathered by the in-cluster prometheus when exported to central monitoring - extraLabelsForMetrics: [] + extraLabelsForMetrics: {} # -- remote write prometheus configuration remoteWrite: {} # endpoint: "https://monit-prom-mom.cern.ch:9090/api/v1/write" -- GitLab