From 4fadac4cfc19934aaa87cf0ea10ba0d02b55e688 Mon Sep 17 00:00:00 2001
From: lorenz <stu203404@mail.uni-kiel.de>
Date: Thu, 6 Jan 2022 12:41:35 +0100
Subject: [PATCH] Add beam samza kubernetes resources

---
 .../resources/uc1-beam-samza-deployment.yaml  | 62 +++++++++++++++++++
 .../resources/uc1-beam-samza-service.yaml     | 17 +++++
 .../resources/uc1-jmx-configmap.yaml          | 10 +++
 .../resources/uc1-service-monitor.yaml        | 14 +++++
 4 files changed, 103 insertions(+)
 create mode 100644 theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-beam-samza-deployment.yaml
 create mode 100644 theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-beam-samza-service.yaml
 create mode 100644 theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-jmx-configmap.yaml
 create mode 100644 theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-service-monitor.yaml

diff --git a/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-beam-samza-deployment.yaml b/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-beam-samza-deployment.yaml
new file mode 100644
index 000000000..34fab9e52
--- /dev/null
+++ b/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-beam-samza-deployment.yaml
@@ -0,0 +1,62 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: titan-ccp-aggregation
+spec:
+  selector:
+    matchLabels:
+      app: titan-ccp-aggregation
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        app: titan-ccp-aggregation
+    spec:
+      terminationGracePeriodSeconds: 0
+      containers:
+        - name: uc-application
+          image: uc1-beam-samza:latest
+          imagePullPolicy: Never # for local testing 
+          ports:
+            - containerPort: 5555
+              name: jmx
+          env:
+            - name: SAMZA_JOB_COORDINATOR_ZK_CONNECT
+              value: "HelloThere"
+            - name: SAMZA_SYSTEMS_KAFKA_CONSUMER_ZOOKEEPER_CONNECT
+              value: "HelloThere"
+            - name: MAX_SOURCE_PARALLELISM
+              value: "1024"
+            - name: KAFKA_BOOTSTRAP_SERVERS
+              value: "theodolite-cp-kafka:9092"
+            - name: SCHEMA_REGISTRY_URL
+              value: "http://theodolite-cp-schema-registry:8081"
+            - name: JAVA_OPTS
+              value: "-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=5555"
+            - name: COMMIT_INTERVAL_MS # Set as default for the applications
+              value: "100"
+          resources:
+            limits:
+              memory: 4Gi
+              cpu: 1000m
+        - name: prometheus-jmx-exporter
+          image: "solsson/kafka-prometheus-jmx-exporter@sha256:6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143"
+          command:
+            - java
+            - -XX:+UnlockExperimentalVMOptions
+            - -XX:+UseCGroupMemoryLimitForHeap
+            - -XX:MaxRAMFraction=1
+            - -XshowSettings:vm
+            - -jar
+            - jmx_prometheus_httpserver.jar
+            - "5556"
+            - /etc/jmx-aggregation/jmx-kafka-prometheus.yml
+          ports:
+            - containerPort: 5556
+          volumeMounts:
+            - name: jmx-config
+              mountPath: /etc/jmx-aggregation
+      volumes:
+        - name: jmx-config
+          configMap:
+            name: uc1-jmx-configmap
\ No newline at end of file
diff --git a/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-beam-samza-service.yaml b/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-beam-samza-service.yaml
new file mode 100644
index 000000000..6317caf9f
--- /dev/null
+++ b/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-beam-samza-service.yaml
@@ -0,0 +1,17 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: titan-ccp-aggregation
+  labels:
+    app: titan-ccp-aggregation
+spec:
+  #type: NodePort
+  selector:
+    app: titan-ccp-aggregation
+  ports:
+  - name: http
+    port: 80
+    targetPort: 80
+    protocol: TCP
+  - name: metrics
+    port: 5556
diff --git a/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-jmx-configmap.yaml b/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-jmx-configmap.yaml
new file mode 100644
index 000000000..af8707291
--- /dev/null
+++ b/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-jmx-configmap.yaml
@@ -0,0 +1,10 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: uc1-jmx-configmap
+data:
+  jmx-kafka-prometheus.yml: |+
+    jmxUrl: service:jmx:rmi:///jndi/rmi://localhost:5555/jmxrmi
+    lowercaseOutputName: true
+    lowercaseOutputLabelNames: true
+    ssl: false
diff --git a/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-service-monitor.yaml b/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-service-monitor.yaml
new file mode 100644
index 000000000..4e7e758ca
--- /dev/null
+++ b/theodolite-benchmarks/definitions/uc1-beam-samza/resources/uc1-service-monitor.yaml
@@ -0,0 +1,14 @@
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+  labels:
+    app: titan-ccp-aggregation
+    appScope: titan-ccp
+  name: titan-ccp-aggregation
+spec:
+  selector:
+    matchLabels:
+        app: titan-ccp-aggregation
+  endpoints:
+    - port: metrics
+      interval: 10s
-- 
GitLab