From ced76fd14d86055eacd6224465fad914d2ba3119 Mon Sep 17 00:00:00 2001
From: Simon Ehrenstein <simon.ehrenstein@gmail.com>
Date: Mon, 21 Feb 2022 10:03:48 +0100
Subject: [PATCH] Update K8s files metadata labels and fix unit tests for slo
 checker

---
 helm/templates/strimzi/kafka-cluster.yaml                | 4 ++--
 helm/templates/strimzi/kafka-exporter-podmonitor.yaml    | 2 +-
 helm/templates/strimzi/kafka-metrics-configmap.yaml      | 2 +-
 helm/templates/strimzi/kafka-podmonitor.yaml             | 5 +----
 slo-checker/record-lag/resources/test-1-rep-success.json | 2 +-
 slo-checker/record-lag/resources/test-3-rep-success.json | 2 +-
 6 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/helm/templates/strimzi/kafka-cluster.yaml b/helm/templates/strimzi/kafka-cluster.yaml
index ab0126f28..f8c0112b5 100644
--- a/helm/templates/strimzi/kafka-cluster.yaml
+++ b/helm/templates/strimzi/kafka-cluster.yaml
@@ -2,7 +2,7 @@
 apiVersion: kafka.strimzi.io/v1beta2
 kind: Kafka
 metadata:
-  name: theodolite-strimzi
+  name: {{ template "theodolite.fullname" . }}-strimzi
 spec:
   kafka:
     jmxOptions: {}
@@ -28,7 +28,7 @@ spec:
       type: jmxPrometheusExporter
       valueFrom:
         configMapKeyRef:
-          name: kafka-metrics
+          name: {{ template "theodolite.fullname" . }}-kafka-metrics
           key: kafka-metrics-config.yml
   
   kafkaExporter: {}
diff --git a/helm/templates/strimzi/kafka-exporter-podmonitor.yaml b/helm/templates/strimzi/kafka-exporter-podmonitor.yaml
index 016cba1bc..5f34a4217 100644
--- a/helm/templates/strimzi/kafka-exporter-podmonitor.yaml
+++ b/helm/templates/strimzi/kafka-exporter-podmonitor.yaml
@@ -9,7 +9,7 @@ spec:
   selector:
     selector:
     matchLabels:
-      strimzi.io/name: theodolite-strimzi-kafka-exporter
+      strimzi.io/name: {{ template "theodolite.fullname" . }}-strimzi-kafka-exporter
   namespaceSelector:
     matchNames:
       - default
diff --git a/helm/templates/strimzi/kafka-metrics-configmap.yaml b/helm/templates/strimzi/kafka-metrics-configmap.yaml
index 179dce05d..ad75bfa6a 100644
--- a/helm/templates/strimzi/kafka-metrics-configmap.yaml
+++ b/helm/templates/strimzi/kafka-metrics-configmap.yaml
@@ -2,7 +2,7 @@
 kind: ConfigMap
 apiVersion: v1
 metadata:
-  name: kafka-metrics
+  name: {{ template "theodolite.fullname" . }}-kafka-metrics
   labels:
     app: strimzi
 data:
diff --git a/helm/templates/strimzi/kafka-podmonitor.yaml b/helm/templates/strimzi/kafka-podmonitor.yaml
index 30d66acc1..6334199cf 100644
--- a/helm/templates/strimzi/kafka-podmonitor.yaml
+++ b/helm/templates/strimzi/kafka-podmonitor.yaml
@@ -9,10 +9,7 @@ spec:
   selector:
     selector:
     matchLabels:
-      strimzi.io/name: theodolite-strimzi-kafka
-  namespaceSelector:
-    matchNames:
-      - default
+      strimzi.io/name: {{ template "theodolite.fullname" . }}-strimzi-kafka
   podMetricsEndpoints:
   - path: /metrics
     port: tcp-prometheus
diff --git a/slo-checker/record-lag/resources/test-1-rep-success.json b/slo-checker/record-lag/resources/test-1-rep-success.json
index dfe112827..09320c5f1 100644
--- a/slo-checker/record-lag/resources/test-1-rep-success.json
+++ b/slo-checker/record-lag/resources/test-1-rep-success.json
@@ -3,7 +3,7 @@
         [
             {
                 "metric": {
-                    "group": "theodolite-uc1-application-0.0.1"
+                    "consumergroup": "theodolite-uc1-application-0.0.1"
                 },
                 "values": [
                     [
diff --git a/slo-checker/record-lag/resources/test-3-rep-success.json b/slo-checker/record-lag/resources/test-3-rep-success.json
index cf483f42f..8e4955693 100644
--- a/slo-checker/record-lag/resources/test-3-rep-success.json
+++ b/slo-checker/record-lag/resources/test-3-rep-success.json
@@ -3,7 +3,7 @@
         [
             {
                 "metric": {
-                    "group": "theodolite-uc1-application-0.0.1"
+                    "consumergroup": "theodolite-uc1-application-0.0.1"
                 },
                 "values": [
                     [
-- 
GitLab