From fdd6ac5b72d866c5e83befa18d86bafa92a79869 Mon Sep 17 00:00:00 2001
From: lorenz <stu203404@mail.uni-kiel.de>
Date: Wed, 9 Feb 2022 16:08:39 +0100
Subject: [PATCH] Add uc3 beam samza benchmark

---
 .../resources/beam-samza-service.yaml         | 17 ++++++
 .../resources/service-monitor.yaml            | 14 +++++
 .../resources/uc3-beam-samza-deployment.yaml  | 38 ++++++++++++
 .../uc3-beam-samza-benchmark-operator.yaml    | 60 +++++++++++++++++++
 4 files changed, 129 insertions(+)
 create mode 100644 theodolite-benchmarks/definitions/uc3-beam-samza/resources/beam-samza-service.yaml
 create mode 100644 theodolite-benchmarks/definitions/uc3-beam-samza/resources/service-monitor.yaml
 create mode 100644 theodolite-benchmarks/definitions/uc3-beam-samza/resources/uc3-beam-samza-deployment.yaml
 create mode 100644 theodolite-benchmarks/definitions/uc3-beam-samza/uc3-beam-samza-benchmark-operator.yaml

diff --git a/theodolite-benchmarks/definitions/uc3-beam-samza/resources/beam-samza-service.yaml b/theodolite-benchmarks/definitions/uc3-beam-samza/resources/beam-samza-service.yaml
new file mode 100644
index 000000000..6317caf9f
--- /dev/null
+++ b/theodolite-benchmarks/definitions/uc3-beam-samza/resources/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/uc3-beam-samza/resources/service-monitor.yaml b/theodolite-benchmarks/definitions/uc3-beam-samza/resources/service-monitor.yaml
new file mode 100644
index 000000000..4e7e758ca
--- /dev/null
+++ b/theodolite-benchmarks/definitions/uc3-beam-samza/resources/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
diff --git a/theodolite-benchmarks/definitions/uc3-beam-samza/resources/uc3-beam-samza-deployment.yaml b/theodolite-benchmarks/definitions/uc3-beam-samza/resources/uc3-beam-samza-deployment.yaml
new file mode 100644
index 000000000..8b59dfbd9
--- /dev/null
+++ b/theodolite-benchmarks/definitions/uc3-beam-samza/resources/uc3-beam-samza-deployment.yaml
@@ -0,0 +1,38 @@
+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: uc3-beam-samza
+          image: ghcr.io/cau-se/theodolite-uc3-beam-samza:latest
+          ports:
+          env:
+            - name: SAMZA_JOB_COORDINATOR_ZK_CONNECT
+              value: "theodolite-cp-zookeeper:2181"
+            - name: SAMZA_SYSTEMS_KAFKA_PRODUCER_BOOTSTRAP_SERVERS
+              value: "theodolite-cp-kafka:9092"
+            - name: SAMZA_SYSTEMS_KAFKA_CONSUMER_BOOTSTRAP_SERVERS
+              value: "theodolite-cp-kafka:9092"
+            - 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: COMMIT_INTERVAL_MS # Set as default for the applications
+              value: "100"
+          resources:
+            limits:
+              memory: 4Gi
+              cpu: 1000m
\ No newline at end of file
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
new file mode 100644
index 000000000..ecfab8d80
--- /dev/null
+++ b/theodolite-benchmarks/definitions/uc3-beam-samza/uc3-beam-samza-benchmark-operator.yaml
@@ -0,0 +1,60 @@
+apiVersion: theodolite.com/v1
+kind: benchmark
+metadata:
+  name: uc3-beam-samza
+spec:
+  sut:
+    resources:
+      - configMap:
+          name: "benchmark-resources-uc3-beam-samza"
+          files:
+          - "uc3-beam-samza-deployment.yaml"
+          - "beam-samza-service.yaml"
+          - "service-monitor.yaml"
+    afterActions:
+      - selector: # delete zookeeper nodes to reset zookeeper
+          pod:
+            matchLabels:
+              app: "cp-zookeeper"
+          container: "cp-zookeeper-server"
+        exec:
+          command: ["zookeeper-shell", "localhost:2181",
+           "deleteall", "/app-theodolite-uc3-application-1"]
+          timeoutSeconds: 60
+  loadGenerator:
+    resources:
+      - configMap:
+          name: "benchmark-resources-uc3-load-generator"
+          files:
+          - "uc3-load-generator-deployment.yaml"
+          - "uc3-load-generator-service.yaml"
+  resourceTypes:
+    - typeName: "Instances"
+      patchers:
+        - type: "ReplicaPatcher"
+          resource: "uc3-beam-samza-deployment.yaml"
+  loadTypes:
+    - typeName: "NumSensors"
+      patchers:
+        - type: "EnvVarPatcher"
+          resource: "uc3-load-generator-deployment.yaml"
+          properties:
+            container: "workload-generator"
+            variableName: "NUM_SENSORS"
+        - type: NumSensorsLoadGeneratorReplicaPatcher
+          resource: "uc3-load-generator-deployment.yaml"
+          properties:
+            loadGenMaxRecords: "150000"
+  kafkaConfig:
+    bootstrapServer: "theodolite-cp-kafka:9092"
+    topics:
+      - name: "input"
+        numPartitions: 40
+        replicationFactor: 1
+      - name: "output"
+        numPartitions: 40
+        replicationFactor: 1
+      - name: ".*samza.*"
+        removeOnly: true
+      - name: ".*uc3-application.*"
+        removeOnly: true
\ No newline at end of file
-- 
GitLab