From d9838355df9ad12b9edc9fe8f461d39eec7a4ded Mon Sep 17 00:00:00 2001
From: Guillermo Facundo Colunga <guillermo.facundo.colunga@cern.ch>
Date: Tue, 21 Jan 2025 16:08:35 +0100
Subject: [PATCH] [MONIT-4105] templates/kubelet: allow user provided
 relabelings

---
 templates/kubelet/servicemonitor.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/templates/kubelet/servicemonitor.yaml b/templates/kubelet/servicemonitor.yaml
index 800d28f..6c224f3 100644
--- a/templates/kubelet/servicemonitor.yaml
+++ b/templates/kubelet/servicemonitor.yaml
@@ -13,6 +13,10 @@ spec:
     tlsConfig:
       insecureSkipVerify: true
     bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
+    {{- if and .Values.metrics.kubelet .Values.metrics.kubelet.relabelings }}
+    relabelings:
+    {{- .Values.metrics.kubelet.relabelings | toYaml | nindent 4}}
+    {{- end }}
   - port: https-metrics
     scheme: https
     path: /metrics/cadvisor
@@ -21,6 +25,10 @@ spec:
     tlsConfig:
       insecureSkipVerify: true
     bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
+    {{- if and .Values.metrics.kubelet .Values.metrics.kubelet.serviceMonitor.relabelings }}
+    relabelings:
+    {{- .Values.metrics.kubelet.serviceMonitor.relabelings | toYaml | nindent 4}}
+    {{- end }}
   selector:
     matchLabels:
       app.kubernetes.io/name: kubelet
-- 
GitLab