From cf916082b802ec72b682dcdf784a58088144aa31 Mon Sep 17 00:00:00 2001
From: Frederic Branczyk <fbranczyk@gmail.com>
Date: Mon, 4 Jan 2021 16:45:27 +0100
Subject: [PATCH] kubelet: Revert label selector

The Kubelet's Service/Endpoints object maintained by the Prometheus
Operator does not have the recommended app label (yet). Therefore we
need to use the old label until a Prometheus Operator version has been
released and integrated in kube-promteheus that does use it.
---
 jsonnet/kube-prometheus/prometheus/prometheus.libsonnet | 4 ++--
 manifests/prometheus-serviceMonitorKubelet.yaml         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet b/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
index 7f8a2c35..fc99add3 100644
--- a/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
+++ b/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
@@ -309,7 +309,7 @@ local relabelings = import 'kube-prometheus/dropping-deprecated-metrics-relabeli
         labels: { 'app.kubernetes.io/name': 'kubelet' },
       },
       spec: {
-        jobLabel: 'app.kubernetes.io/name',
+        jobLabel: 'k8s-app',
         endpoints: [
           {
             port: 'https-metrics',
@@ -364,7 +364,7 @@ local relabelings = import 'kube-prometheus/dropping-deprecated-metrics-relabeli
           },
         ],
         selector: {
-          matchLabels: { 'app.kubernetes.io/name': 'kubelet' },
+          matchLabels: { 'k8s-app': 'kubelet' },
         },
         namespaceSelector: {
           matchNames: ['kube-system'],
diff --git a/manifests/prometheus-serviceMonitorKubelet.yaml b/manifests/prometheus-serviceMonitorKubelet.yaml
index dc329395..72dff3fb 100644
--- a/manifests/prometheus-serviceMonitorKubelet.yaml
+++ b/manifests/prometheus-serviceMonitorKubelet.yaml
@@ -81,10 +81,10 @@ spec:
     scheme: https
     tlsConfig:
       insecureSkipVerify: true
-  jobLabel: app.kubernetes.io/name
+  jobLabel: k8s-app
   namespaceSelector:
     matchNames:
     - kube-system
   selector:
     matchLabels:
-      app.kubernetes.io/name: kubelet
+      k8s-app: kubelet
-- 
GitLab