From e7d2135cea2430d469e32fe839d8fa52fba1a15f Mon Sep 17 00:00:00 2001
From: Haoyu Sun <hasun@redhat.com>
Date: Thu, 7 Oct 2021 15:11:21 +0200
Subject: [PATCH] replace deprecated "app" label selector by
 "app.kubernetes.io/name" in documents and examples

---
 README.md                                               | 2 +-
 examples/additional-namespaces-servicemonitor.jsonnet   | 2 +-
 examples/basic-auth/service-monitor.yaml                | 2 +-
 examples/example-app/example-app.yaml                   | 8 ++++----
 jsonnet/kube-prometheus/addons/ksm-autoscaler.libsonnet | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index a130aaca..a271c16f 100644
--- a/README.md
+++ b/README.md
@@ -575,7 +575,7 @@ local kp = (import 'kube-prometheus/main.libsonnet') + {
         ],
         selector: {
           matchLabels: {
-            app: 'myapp',
+            'app.kubernetes.io/name': 'myapp',
           },
         },
       },
diff --git a/examples/additional-namespaces-servicemonitor.jsonnet b/examples/additional-namespaces-servicemonitor.jsonnet
index ec978da7..31d4f7c3 100644
--- a/examples/additional-namespaces-servicemonitor.jsonnet
+++ b/examples/additional-namespaces-servicemonitor.jsonnet
@@ -24,7 +24,7 @@ local kp = (import 'kube-prometheus/main.libsonnet') + {
         ],
         selector: {
           matchLabels: {
-            app: 'myapp',
+            'app.kubernetes.io/name': 'myapp',
           },
         },
       },
diff --git a/examples/basic-auth/service-monitor.yaml b/examples/basic-auth/service-monitor.yaml
index e62b9fa9..82ac0b65 100644
--- a/examples/basic-auth/service-monitor.yaml
+++ b/examples/basic-auth/service-monitor.yaml
@@ -19,4 +19,4 @@ spec:
     - logging
   selector:
     matchLabels:
-      app: myapp
\ No newline at end of file
+      app.kubernetes.io/name: myapp
\ No newline at end of file
diff --git a/examples/example-app/example-app.yaml b/examples/example-app/example-app.yaml
index 69a2ab7e..71d9e567 100644
--- a/examples/example-app/example-app.yaml
+++ b/examples/example-app/example-app.yaml
@@ -7,7 +7,7 @@ metadata:
   namespace: default
 spec:
   selector:
-    app: example-app
+    app.kubernetes.io/name: example-app
   ports:
   - name: web
     protocol: TCP
@@ -22,17 +22,17 @@ metadata:
 spec:
   selector:
     matchLabels:
-      app: example-app
+      app.kubernetes.io/name: example-app
       version: 1.1.3
   replicas: 4
   template:
     metadata:
       labels:
-        app: example-app
+        app.kubernetes.io/name: example-app
         version: 1.1.3
     spec:
       containers:
-      - name: example-app 
+      - name: example-app
         image: quay.io/fabxc/prometheus_demo_service
         ports:
         - name: web
diff --git a/jsonnet/kube-prometheus/addons/ksm-autoscaler.libsonnet b/jsonnet/kube-prometheus/addons/ksm-autoscaler.libsonnet
index fa2caf0e..9573072c 100644
--- a/jsonnet/kube-prometheus/addons/ksm-autoscaler.libsonnet
+++ b/jsonnet/kube-prometheus/addons/ksm-autoscaler.libsonnet
@@ -81,7 +81,7 @@
     },
 
     deployment:
-      local podLabels = { app: 'ksm-autoscaler' };
+      local podLabels = { 'app.kubernetes.io/name': 'ksm-autoscaler' };
       local c = {
         name: 'ksm-autoscaler',
         image: $.values.clusterVerticalAutoscaler.image,
-- 
GitLab