From abbbefc64f04faff41d0360ecb992d497ddafe4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de>
Date: Thu, 24 Feb 2022 19:06:58 +0100
Subject: [PATCH] Add Zookeeper client to Helm

---
 .../infrastructure/zookeeper-client.yaml      |  4 +++-
 .../{strimzi => kafka}/kafka-cluster.yaml     |  0
 .../kafka-exporter-podmonitor.yaml            |  0
 .../kafka-metrics-configmap.yaml              |  0
 .../{strimzi => kafka}/kafka-podmonitor.yaml  |  0
 helm/templates/kafka/service-monitor.yaml     | 16 -------------
 helm/templates/kafka/zookeeper-client.yaml    | 23 +++++++++++++++++++
 .../zookeeper-entrance-deployment.yaml        |  0
 .../zookeeper-entrance-network.yaml           |  0
 .../zookeeper-entrance-service.yaml           |  0
 .../uc1-beam-samza-benchmark-operator.yaml    |  2 +-
 .../uc2-beam-samza-benchmark-operator.yaml    |  2 +-
 .../uc3-beam-samza-benchmark-operator.yaml    |  2 +-
 .../uc4-beam-samza-benchmark-operator.yaml    |  2 +-
 14 files changed, 30 insertions(+), 21 deletions(-)
 rename helm/templates/{strimzi => kafka}/kafka-cluster.yaml (100%)
 rename helm/templates/{strimzi => kafka}/kafka-exporter-podmonitor.yaml (100%)
 rename helm/templates/{strimzi => kafka}/kafka-metrics-configmap.yaml (100%)
 rename helm/templates/{strimzi => kafka}/kafka-podmonitor.yaml (100%)
 delete mode 100644 helm/templates/kafka/service-monitor.yaml
 create mode 100644 helm/templates/kafka/zookeeper-client.yaml
 rename helm/templates/{strimzi => kafka}/zookeeper-entrance-deployment.yaml (100%)
 rename helm/templates/{strimzi => kafka}/zookeeper-entrance-network.yaml (100%)
 rename helm/templates/{strimzi => kafka}/zookeeper-entrance-service.yaml (100%)

diff --git a/execution/infrastructure/zookeeper-client.yaml b/execution/infrastructure/zookeeper-client.yaml
index 9d6d00275..85739bba7 100644
--- a/execution/infrastructure/zookeeper-client.yaml
+++ b/execution/infrastructure/zookeeper-client.yaml
@@ -2,10 +2,12 @@ apiVersion: v1
 kind: Pod
 metadata:
   name: zookeeper-client
+  labels:
+    app: zookeeper-client
 spec:
   containers:
   - name: zookeeper-client
-    image: confluentinc/cp-zookeeper:5.4.0
+    image: zookeeper:3.7.0
     command:
       - sh
       - -c
diff --git a/helm/templates/strimzi/kafka-cluster.yaml b/helm/templates/kafka/kafka-cluster.yaml
similarity index 100%
rename from helm/templates/strimzi/kafka-cluster.yaml
rename to helm/templates/kafka/kafka-cluster.yaml
diff --git a/helm/templates/strimzi/kafka-exporter-podmonitor.yaml b/helm/templates/kafka/kafka-exporter-podmonitor.yaml
similarity index 100%
rename from helm/templates/strimzi/kafka-exporter-podmonitor.yaml
rename to helm/templates/kafka/kafka-exporter-podmonitor.yaml
diff --git a/helm/templates/strimzi/kafka-metrics-configmap.yaml b/helm/templates/kafka/kafka-metrics-configmap.yaml
similarity index 100%
rename from helm/templates/strimzi/kafka-metrics-configmap.yaml
rename to helm/templates/kafka/kafka-metrics-configmap.yaml
diff --git a/helm/templates/strimzi/kafka-podmonitor.yaml b/helm/templates/kafka/kafka-podmonitor.yaml
similarity index 100%
rename from helm/templates/strimzi/kafka-podmonitor.yaml
rename to helm/templates/kafka/kafka-podmonitor.yaml
diff --git a/helm/templates/kafka/service-monitor.yaml b/helm/templates/kafka/service-monitor.yaml
deleted file mode 100644
index 68fd5f759..000000000
--- a/helm/templates/kafka/service-monitor.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-{{- if .Values.kafkaClient.enabled -}}
-apiVersion: monitoring.coreos.com/v1
-kind: ServiceMonitor
-metadata:
-  labels:
-    app: cp-kafka
-    appScope: titan-ccp
-  name: {{ template "theodolite.fullname" . }}-cp-kafka
-spec:
-  selector:
-    matchLabels:
-      app: cp-kafka
-  endpoints:
-    - port: metrics
-      interval: 7s
-{{- end}}
diff --git a/helm/templates/kafka/zookeeper-client.yaml b/helm/templates/kafka/zookeeper-client.yaml
new file mode 100644
index 000000000..2154ec116
--- /dev/null
+++ b/helm/templates/kafka/zookeeper-client.yaml
@@ -0,0 +1,23 @@
+{{- if .Values.strimzi.zookeeper.zooEntrance.zookeeperClient.enabled -}}
+apiVersion: v1
+kind: Pod
+metadata:
+  name: {{ template "theodolite.fullname" . }}-kafka-zookeeper-client
+  labels:
+    app: zookeeper-client
+spec:
+  containers:
+  - name: zookeeper-client
+    image: zookeeper:3.7.0
+    command:
+      - sh
+      - -c
+      - "exec tail -f /dev/null"
+    env:
+    - name: ZOOKEEPER_SERVER
+      value: {{ template "theodolite.fullname" . }}-kafka-zoo-entrance:2181
+  {{- with .Values.strimzi.zookeeper.zooEntrance.zookeeperClient.nodeSelector }}
+  nodeSelector:
+    {{- toYaml . | nindent 8 }}
+  {{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/helm/templates/strimzi/zookeeper-entrance-deployment.yaml b/helm/templates/kafka/zookeeper-entrance-deployment.yaml
similarity index 100%
rename from helm/templates/strimzi/zookeeper-entrance-deployment.yaml
rename to helm/templates/kafka/zookeeper-entrance-deployment.yaml
diff --git a/helm/templates/strimzi/zookeeper-entrance-network.yaml b/helm/templates/kafka/zookeeper-entrance-network.yaml
similarity index 100%
rename from helm/templates/strimzi/zookeeper-entrance-network.yaml
rename to helm/templates/kafka/zookeeper-entrance-network.yaml
diff --git a/helm/templates/strimzi/zookeeper-entrance-service.yaml b/helm/templates/kafka/zookeeper-entrance-service.yaml
similarity index 100%
rename from helm/templates/strimzi/zookeeper-entrance-service.yaml
rename to helm/templates/kafka/zookeeper-entrance-service.yaml
diff --git a/theodolite-benchmarks/definitions/uc1-beam-samza/uc1-beam-samza-benchmark-operator.yaml b/theodolite-benchmarks/definitions/uc1-beam-samza/uc1-beam-samza-benchmark-operator.yaml
index 1677402fc..3a9c965b8 100644
--- a/theodolite-benchmarks/definitions/uc1-beam-samza/uc1-beam-samza-benchmark-operator.yaml
+++ b/theodolite-benchmarks/definitions/uc1-beam-samza/uc1-beam-samza-benchmark-operator.yaml
@@ -18,7 +18,7 @@ spec:
               app: "zookeeper-client"
           container: "zookeeper-client"
         exec:
-          command: ["bin/zkCli.sh", "-server", "theodolite-kafka-zoo-entrance:2181", "deleteall", "/app-theodolite-uc1-application-1"]
+          command: ["bin/zkCli.sh", "-server", "$ZOOKEEPER_SERVER", "deleteall", "/app-theodolite-uc1-application-1"]
           timeoutSeconds: 60
   loadGenerator:
     resources:
diff --git a/theodolite-benchmarks/definitions/uc2-beam-samza/uc2-beam-samza-benchmark-operator.yaml b/theodolite-benchmarks/definitions/uc2-beam-samza/uc2-beam-samza-benchmark-operator.yaml
index 2a52ef26a..9fafe0082 100644
--- a/theodolite-benchmarks/definitions/uc2-beam-samza/uc2-beam-samza-benchmark-operator.yaml
+++ b/theodolite-benchmarks/definitions/uc2-beam-samza/uc2-beam-samza-benchmark-operator.yaml
@@ -36,7 +36,7 @@ spec:
               app: "zookeeper-client"
           container: "zookeeper-client"
         exec:
-          command: ["bin/zkCli.sh", "-server", "theodolite-kafka-zoo-entrance:2181", "deleteall", "/app-theodolite-uc2-application-1"]
+          command: ["bin/zkCli.sh", "-server", "$ZOOKEEPER_SERVER", "deleteall", "/app-theodolite-uc2-application-1"]
           timeoutSeconds: 60
   loadGenerator:
     resources:
diff --git a/theodolite-benchmarks/definitions/uc3-beam-samza/uc3-beam-samza-benchmark-operator.yaml b/theodolite-benchmarks/definitions/uc3-beam-samza/uc3-beam-samza-benchmark-operator.yaml
index 314b5037c..656fd0982 100644
--- a/theodolite-benchmarks/definitions/uc3-beam-samza/uc3-beam-samza-benchmark-operator.yaml
+++ b/theodolite-benchmarks/definitions/uc3-beam-samza/uc3-beam-samza-benchmark-operator.yaml
@@ -18,7 +18,7 @@ spec:
               app: "zookeeper-client"
           container: "zookeeper-client"
         exec:
-          command: ["bin/zkCli.sh", "-server", "theodolite-kafka-zoo-entrance:2181", "deleteall", "/app-theodolite-uc3-application-1"]
+          command: ["bin/zkCli.sh", "-server", "$ZOOKEEPER_SERVER", "deleteall", "/app-theodolite-uc3-application-1"]
           timeoutSeconds: 60
   loadGenerator:
     resources:
diff --git a/theodolite-benchmarks/definitions/uc4-beam-samza/uc4-beam-samza-benchmark-operator.yaml b/theodolite-benchmarks/definitions/uc4-beam-samza/uc4-beam-samza-benchmark-operator.yaml
index cc12390f5..949edbb2c 100644
--- a/theodolite-benchmarks/definitions/uc4-beam-samza/uc4-beam-samza-benchmark-operator.yaml
+++ b/theodolite-benchmarks/definitions/uc4-beam-samza/uc4-beam-samza-benchmark-operator.yaml
@@ -18,7 +18,7 @@ spec:
               app: "zookeeper-client"
           container: "zookeeper-client"
         exec:
-          command: ["bin/zkCli.sh", "-server", "theodolite-kafka-zoo-entrance:2181", "deleteall", "/app-theodolite-uc4-application-1"]
+          command: ["bin/zkCli.sh", "-server", "$ZOOKEEPER_SERVER", "deleteall", "/app-theodolite-uc4-application-1"]
           timeoutSeconds: 60
   loadGenerator:
     resources:
-- 
GitLab