From ec392c38287db711fc36d4b440e8cab786a5ed1b Mon Sep 17 00:00:00 2001 From: Jetchko Jekov Date: Fri, 10 Apr 2020 10:05:18 +0200 Subject: [PATCH] Fix serviceMonitorKubelet's metricRelabelings (#225) Signed-off-by: Jetchko Jekov --- jsonnet/custom-prometheus.jsonnet | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/jsonnet/custom-prometheus.jsonnet b/jsonnet/custom-prometheus.jsonnet index 99b6caca00..9c733766ba 100644 --- a/jsonnet/custom-prometheus.jsonnet +++ b/jsonnet/custom-prometheus.jsonnet @@ -27,13 +27,21 @@ prometheus+:: { serviceMonitorKubelet+: { spec+: { - metricRelabelings+: [ - { - action: 'replace', - sourceLabels: ['node'], - targetLabel: 'instance', - }, - ], + endpoints: std.map(function(endpoint) + if endpoint.port == "https-metrics" then + endpoint { + metricRelabelings+: [ + { + action: 'replace', + sourceLabels: ['node'], + targetLabel: 'instance', + }, + ], + } + else + endpoint, + super.endpoints + ), }, }, },