From bba6adf83de5ee3371c8c9d579d62893309b8078 Mon Sep 17 00:00:00 2001
From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de>
Date: Wed, 1 Sep 2021 12:55:40 +0200
Subject: [PATCH] add example configmap and update standalone benchmark example
 in order to use the new resource sets

---
 .../examples/operator/example-configmap.yaml  | 160 ++++++++++++++++++
 .../standalone/example-benchmark.yaml         |  34 +++-
 2 files changed, 186 insertions(+), 8 deletions(-)
 create mode 100644 theodolite/examples/operator/example-configmap.yaml

diff --git a/theodolite/examples/operator/example-configmap.yaml b/theodolite/examples/operator/example-configmap.yaml
new file mode 100644
index 000000000..23bb3e021
--- /dev/null
+++ b/theodolite/examples/operator/example-configmap.yaml
@@ -0,0 +1,160 @@
+apiVersion: v1
+data:
+  aggregation-service.yaml: "apiVersion: v1\nkind: Service\nmetadata:  \n  name: titan-ccp-aggregation\n
+    \ labels:\n    app: titan-ccp-aggregation\nspec:\n  #type: NodePort\n  selector:
+    \   \n    app: titan-ccp-aggregation\n  ports:  \n  - name: http\n    port: 80\n
+    \   targetPort: 80\n    protocol: TCP\n  - name: metrics\n    port: 5556\n"
+  jmx-configmap.yaml: |
+    apiVersion: v1
+    kind: ConfigMap
+    metadata:
+      name: aggregation-jmx-configmap
+    data:
+      jmx-kafka-prometheus.yml: |+
+        jmxUrl: service:jmx:rmi:///jndi/rmi://localhost:5555/jmxrmi
+        lowercaseOutputName: true
+        lowercaseOutputLabelNames: true
+        ssl: false
+  service-monitor.yaml: |
+    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
+  uc1-kstreams-deployment.yaml: |-
+    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: ghcr.io/cau-se/theodolite-uc1-kstreams-app:latest
+              ports:
+                - containerPort: 5555
+                  name: jmx
+              env:
+                - 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: aggregation-jmx-configmap
+  uc1-load-generator-deployment.yaml: |
+    apiVersion: apps/v1
+    kind: Deployment
+    metadata:
+      name: titan-ccp-load-generator
+    spec:
+      selector:
+        matchLabels:
+          app: titan-ccp-load-generator
+      replicas: 1
+      template:
+        metadata:
+          labels:
+            app: titan-ccp-load-generator
+        spec:
+          terminationGracePeriodSeconds: 0
+          containers:
+            - name: workload-generator
+              image: ghcr.io/cau-se/theodolite-uc1-workload-generator:latest
+              ports:
+                - containerPort: 5701
+                  name: coordination
+              env:
+                - name: NUM_SENSORS
+                  value: "25000"
+                - name: NUM_NESTED_GROUPS
+                  value: "5"
+                - name: KUBERNETES_NAMESPACE
+                  valueFrom:
+                    fieldRef:
+                      fieldPath: metadata.namespace
+                - name: KUBERNETES_DNS_NAME
+                  value: "titan-ccp-load-generator.$(KUBERNETES_NAMESPACE).svc.cluster.local"
+                - name: KAFKA_BOOTSTRAP_SERVERS
+                  value: "theodolite-cp-kafka:9092"
+                - name: SCHEMA_REGISTRY_URL
+                  value: "http://theodolite-cp-schema-registry:8081"
+  uc1-load-generator-service.yaml: |
+    apiVersion: v1
+    kind: Service
+    metadata:
+      name: titan-ccp-load-generator
+      labels:
+        app: titan-ccp-load-generator
+    spec:
+      type: ClusterIP
+      clusterIP: None
+      selector:
+        app: titan-ccp-load-generator
+      ports:
+        - name: coordination
+          port: 5701
+          targetPort: 5701
+          protocol: TCP
+  uc1-service-monitor.yaml: |
+    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
+kind: ConfigMap
+metadata:
+  name: example-configmap
diff --git a/theodolite/examples/standalone/example-benchmark.yaml b/theodolite/examples/standalone/example-benchmark.yaml
index 83edce938..e9397def4 100644
--- a/theodolite/examples/standalone/example-benchmark.yaml
+++ b/theodolite/examples/standalone/example-benchmark.yaml
@@ -1,12 +1,4 @@
 name: "uc1-kstreams"
-appResource:
-  - "uc1-kstreams-deployment.yaml"
-  - "aggregation-service.yaml"
-  - "jmx-configmap.yaml"
-  - "uc1-service-monitor.yaml"
-loadGenResource:
-  - "uc1-load-generator-deployment.yaml"
-  - "uc1-load-generator-service.yaml"
 resourceTypes:
   - typeName: "Instances"
     patchers:
@@ -32,3 +24,29 @@ kafkaConfig:
       replicationFactor: 1
     - name: "theodolite-.*"
       removeOnly: True
+appResourceSets:
+  # - fileSystem:
+  #      path: ./../../../../../../config
+  #      files:
+  #        - "uc1-kstreams-deployment.yaml"
+  #        - "aggregation-service.yaml"
+  #        - "jmx-configmap.yaml"
+  #        - "uc1-service-monitor.yaml"
+  - configMap:
+      name: "example-configmap"
+      files:
+        - "uc1-kstreams-deployment.yaml"
+        - "aggregation-service.yaml"
+        - "jmx-configmap.yaml"
+        - "uc1-service-monitor.yaml"
+loadGenResourceSets:
+  # - fileSystem:
+  #     path: ./../../../../../../config
+  #     files:
+  #       - uc1-load-generator-service.yaml
+  #       - uc1-load-generator-deployment.yaml
+  - configMap:
+      name: "example-configmap"
+      files:
+        - uc1-load-generator-service.yaml
+        - uc1-load-generator-deployment.yaml
\ No newline at end of file
-- 
GitLab