From 474d4e39dcb0ef284f941ab2c069f29b967107e6 Mon Sep 17 00:00:00 2001
From: Rajat Vig <rvig@etsy.com>
Date: Tue, 24 Mar 2020 10:41:51 +0000
Subject: [PATCH] Remove the app label for node-exporter

---
 .../kube-prometheus/node-exporter/node-exporter.libsonnet  | 4 ++--
 manifests/node-exporter-daemonset.yaml                     | 7 ++++---
 manifests/node-exporter-service.yaml                       | 3 ++-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet b/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet
index ffa16129..264f4a08 100644
--- a/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet
+++ b/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet
@@ -68,7 +68,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
       local toleration = daemonset.mixin.spec.template.spec.tolerationsType;
       local containerEnv = container.envType;
 
-      local podLabels = { app: 'node-exporter' };
+      local podLabels = $._config.nodeExporter.labels;
 
       local existsToleration = toleration.new() +
                                toleration.withOperator('Exists');
@@ -132,7 +132,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
       daemonset.new() +
       daemonset.mixin.metadata.withName('node-exporter') +
       daemonset.mixin.metadata.withNamespace($._config.namespace) +
-      daemonset.mixin.metadata.withLabels(podLabels + $._config.nodeExporter.labels) +
+      daemonset.mixin.metadata.withLabels(podLabels) +
       daemonset.mixin.spec.selector.withMatchLabels(podLabels) +
       daemonset.mixin.spec.template.metadata.withLabels(podLabels) +
       daemonset.mixin.spec.template.spec.withTolerations([existsToleration]) +
diff --git a/manifests/node-exporter-daemonset.yaml b/manifests/node-exporter-daemonset.yaml
index 80ae5fbe..3e61863a 100644
--- a/manifests/node-exporter-daemonset.yaml
+++ b/manifests/node-exporter-daemonset.yaml
@@ -2,7 +2,6 @@ apiVersion: apps/v1
 kind: DaemonSet
 metadata:
   labels:
-    app: node-exporter
     app.kubernetes.io/name: node-exporter
     app.kubernetes.io/version: v0.18.1
   name: node-exporter
@@ -10,11 +9,13 @@ metadata:
 spec:
   selector:
     matchLabels:
-      app: node-exporter
+      app.kubernetes.io/name: node-exporter
+      app.kubernetes.io/version: v0.18.1
   template:
     metadata:
       labels:
-        app: node-exporter
+        app.kubernetes.io/name: node-exporter
+        app.kubernetes.io/version: v0.18.1
     spec:
       containers:
       - args:
diff --git a/manifests/node-exporter-service.yaml b/manifests/node-exporter-service.yaml
index f2bec65d..174bc0fe 100644
--- a/manifests/node-exporter-service.yaml
+++ b/manifests/node-exporter-service.yaml
@@ -13,4 +13,5 @@ spec:
     port: 9100
     targetPort: https
   selector:
-    app: node-exporter
+    app.kubernetes.io/name: node-exporter
+    app.kubernetes.io/version: v0.18.1
-- 
GitLab