From d313c0d4cfe9fc246afa1dff5a4932e35680871f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Vonheiden?= <bjoern.vonheiden@hotmail.de>
Date: Sun, 7 Jun 2020 11:11:19 +0200
Subject: [PATCH] Add kustomaziation and patch file for use cases

Add kustomaziation and patch files to replace in a later step
the usage of sed in the application sh files.
---
 .../uc1-application/aggregation-deployment.yaml  |  8 ++++----
 .../uc1-application/aggregation-service.yaml     |  6 +++---
 execution/uc1-application/kustomization.yaml     | 15 +++++++++++++++
 execution/uc1-application/set_paramters.yaml     | 16 ++++++++++++++++
 execution/uc1-workload-generator/deployment.yaml |  9 ++++-----
 .../uc1-workload-generator/kustomization.yaml    | 12 ++++++++++++
 .../uc1-workload-generator/set_paramters.yaml    | 15 +++++++++++++++
 .../uc2-application/aggregation-deployment.yaml  |  8 ++++----
 execution/uc2-application/kustomization.yaml     | 15 +++++++++++++++
 execution/uc2-application/set_paramters.yaml     | 16 ++++++++++++++++
 execution/uc2-workload-generator/deployment.yaml |  5 ++---
 .../uc2-workload-generator/kustomization.yaml    | 12 ++++++++++++
 .../uc2-workload-generator/set_paramters.yaml    | 13 +++++++++++++
 .../uc3-application/aggregation-deployment.yaml  |  8 ++++----
 execution/uc3-application/kustomization.yaml     | 15 +++++++++++++++
 execution/uc3-application/set_paramters.yaml     | 16 ++++++++++++++++
 execution/uc3-workload-generator/deployment.yaml |  9 ++++-----
 .../uc3-workload-generator/kustomization.yaml    | 12 ++++++++++++
 .../uc3-workload-generator/set_paramters.yaml    | 15 +++++++++++++++
 .../uc4-application/aggregation-deployment.yaml  |  8 ++++----
 execution/uc4-application/kustomization.yaml     | 15 +++++++++++++++
 execution/uc4-application/set_paramters.yaml     | 16 ++++++++++++++++
 execution/uc4-workload-generator/deployment.yaml |  5 ++---
 .../uc4-workload-generator/kustomization.yaml    | 12 ++++++++++++
 .../uc4-workload-generator/set_paramters.yaml    | 15 +++++++++++++++
 25 files changed, 261 insertions(+), 35 deletions(-)
 create mode 100644 execution/uc1-application/kustomization.yaml
 create mode 100644 execution/uc1-application/set_paramters.yaml
 create mode 100644 execution/uc1-workload-generator/kustomization.yaml
 create mode 100644 execution/uc1-workload-generator/set_paramters.yaml
 create mode 100644 execution/uc2-application/kustomization.yaml
 create mode 100644 execution/uc2-application/set_paramters.yaml
 create mode 100644 execution/uc2-workload-generator/kustomization.yaml
 create mode 100644 execution/uc2-workload-generator/set_paramters.yaml
 create mode 100644 execution/uc3-application/kustomization.yaml
 create mode 100644 execution/uc3-application/set_paramters.yaml
 create mode 100644 execution/uc3-workload-generator/kustomization.yaml
 create mode 100644 execution/uc3-workload-generator/set_paramters.yaml
 create mode 100644 execution/uc4-application/kustomization.yaml
 create mode 100644 execution/uc4-application/set_paramters.yaml
 create mode 100644 execution/uc4-workload-generator/kustomization.yaml
 create mode 100644 execution/uc4-workload-generator/set_paramters.yaml

diff --git a/execution/uc1-application/aggregation-deployment.yaml b/execution/uc1-application/aggregation-deployment.yaml
index d5bccca4a..5232e83b8 100644
--- a/execution/uc1-application/aggregation-deployment.yaml
+++ b/execution/uc1-application/aggregation-deployment.yaml
@@ -23,13 +23,13 @@ spec:
         - name: KAFKA_BOOTSTRAP_SERVERS
           value: "my-confluent-cp-kafka:9092"
         - name: COMMIT_INTERVAL_MS
-          value: "{{KAFKA_STREAMS_COMMIT_INTERVAL_MS}}"
+          value: 100
         - 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"
         resources:
           limits:
-            memory: "{{MEMORY_LIMIT}}"
-            cpu: "{{CPU_LIMIT}}"
+            memory: 4Gi
+            cpu: 1000m
       - name: prometheus-jmx-exporter
         image: "solsson/kafka-prometheus-jmx-exporter@sha256:6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143"
         command:
@@ -50,4 +50,4 @@ spec:
       volumes:
         - name: jmx-config
           configMap:
-            name: aggregation-jmx-configmap
\ No newline at end of file
+            name: aggregation-jmx-configmap
diff --git a/execution/uc1-application/aggregation-service.yaml b/execution/uc1-application/aggregation-service.yaml
index 85432d04f..6317caf9f 100644
--- a/execution/uc1-application/aggregation-service.yaml
+++ b/execution/uc1-application/aggregation-service.yaml
@@ -1,14 +1,14 @@
 apiVersion: v1
 kind: Service
-metadata:  
+metadata:
   name: titan-ccp-aggregation
   labels:
     app: titan-ccp-aggregation
 spec:
   #type: NodePort
-  selector:    
+  selector:
     app: titan-ccp-aggregation
-  ports:  
+  ports:
   - name: http
     port: 80
     targetPort: 80
diff --git a/execution/uc1-application/kustomization.yaml b/execution/uc1-application/kustomization.yaml
new file mode 100644
index 000000000..ab5c91fbc
--- /dev/null
+++ b/execution/uc1-application/kustomization.yaml
@@ -0,0 +1,15 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonLabels:
+  app: titan-ccp-aggregation
+
+# Use all resources to compose them into one file
+resources:
+  - aggregation-deployment.yaml
+  - aggregation-service.yaml
+  - service-monitor.yaml
+  - jmx-configmap.yaml
+
+patchesStrategicMerge:
+- set_paramters.yaml # Patch setting the resource parameters
diff --git a/execution/uc1-application/set_paramters.yaml b/execution/uc1-application/set_paramters.yaml
new file mode 100644
index 000000000..af64785a6
--- /dev/null
+++ b/execution/uc1-application/set_paramters.yaml
@@ -0,0 +1,16 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: titan-ccp-aggregation
+spec:
+  template:
+    spec:
+      containers:
+      - name: uc1-application
+        env:
+        - name: COMMIT_INTERVAL_MS
+          value: 100
+        resources:
+          limits:
+            memory: 4Gi
+            cpu: 1000m
diff --git a/execution/uc1-workload-generator/deployment.yaml b/execution/uc1-workload-generator/deployment.yaml
index a0fde4bbf..d73248526 100644
--- a/execution/uc1-workload-generator/deployment.yaml
+++ b/execution/uc1-workload-generator/deployment.yaml
@@ -7,7 +7,7 @@ spec:
     matchLabels:
       app: titan-ccp-load-generator
   serviceName: titan-ccp-load-generator
-  replicas: {{INSTANCES}}
+  replicas: 1
   template:
     metadata:
       labels:
@@ -16,16 +16,15 @@ spec:
       terminationGracePeriodSeconds: 0
       containers:
       - name: workload-generator
-        image: soerenhenning/uc1-wg:latest 
+        image: soerenhenning/uc1-wg:latest
         env:
         - name: KAFKA_BOOTSTRAP_SERVERS
           value: "my-confluent-cp-kafka:9092"
         - name: NUM_SENSORS
-          value: "{{NUM_SENSORS}}"
+          value: 25000
         - name: POD_NAME
           valueFrom:
             fieldRef:
               fieldPath: metadata.name
         - name: INSTANCES
-          value: "{{INSTANCES}}"
-          
\ No newline at end of file
+          value: 1
diff --git a/execution/uc1-workload-generator/kustomization.yaml b/execution/uc1-workload-generator/kustomization.yaml
new file mode 100644
index 000000000..17c5d2e19
--- /dev/null
+++ b/execution/uc1-workload-generator/kustomization.yaml
@@ -0,0 +1,12 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonLabels:
+  app: titan-ccp-aggregation
+
+# Use all resources to compose them into one file
+resources:
+  - deployment.yaml
+
+patchesStrategicMerge:
+- set_paramters.yaml # Patch setting the parameters
diff --git a/execution/uc1-workload-generator/set_paramters.yaml b/execution/uc1-workload-generator/set_paramters.yaml
new file mode 100644
index 000000000..9d512893f
--- /dev/null
+++ b/execution/uc1-workload-generator/set_paramters.yaml
@@ -0,0 +1,15 @@
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: titan-ccp-load-generator
+spec:
+  replicas: 1
+  template:
+    spec:
+      containers:
+      - name: workload-generator
+        env:
+        - name: NUM_SENSORS
+          value: 25000
+        - name: INSTANCES
+          value: 1
diff --git a/execution/uc2-application/aggregation-deployment.yaml b/execution/uc2-application/aggregation-deployment.yaml
index ce5242173..a0f8b4354 100644
--- a/execution/uc2-application/aggregation-deployment.yaml
+++ b/execution/uc2-application/aggregation-deployment.yaml
@@ -23,13 +23,13 @@ spec:
         - name: KAFKA_BOOTSTRAP_SERVERS
           value: "my-confluent-cp-kafka:9092"
         - name: COMMIT_INTERVAL_MS
-          value: "{{KAFKA_STREAMS_COMMIT_INTERVAL_MS}}"
+          value: 100
         - 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"
         resources:
           limits:
-            memory: "{{MEMORY_LIMIT}}"
-            cpu: "{{CPU_LIMIT}}"
+            memory: 4Gi
+            cpu: 1000m
       - name: prometheus-jmx-exporter
         image: "solsson/kafka-prometheus-jmx-exporter@sha256:6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143"
         command:
@@ -50,4 +50,4 @@ spec:
       volumes:
         - name: jmx-config
           configMap:
-            name: aggregation-jmx-configmap
\ No newline at end of file
+            name: aggregation-jmx-configmap
diff --git a/execution/uc2-application/kustomization.yaml b/execution/uc2-application/kustomization.yaml
new file mode 100644
index 000000000..ab5c91fbc
--- /dev/null
+++ b/execution/uc2-application/kustomization.yaml
@@ -0,0 +1,15 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonLabels:
+  app: titan-ccp-aggregation
+
+# Use all resources to compose them into one file
+resources:
+  - aggregation-deployment.yaml
+  - aggregation-service.yaml
+  - service-monitor.yaml
+  - jmx-configmap.yaml
+
+patchesStrategicMerge:
+- set_paramters.yaml # Patch setting the resource parameters
diff --git a/execution/uc2-application/set_paramters.yaml b/execution/uc2-application/set_paramters.yaml
new file mode 100644
index 000000000..cee53281f
--- /dev/null
+++ b/execution/uc2-application/set_paramters.yaml
@@ -0,0 +1,16 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: titan-ccp-aggregation
+spec:
+  template:
+    spec:
+      containers:
+      - name: uc2-application
+        env:
+        - name: COMMIT_INTERVAL_MS
+          value: 100
+        resources:
+          limits:
+            memory: 4Gi
+            cpu: 1000m
diff --git a/execution/uc2-workload-generator/deployment.yaml b/execution/uc2-workload-generator/deployment.yaml
index 52592626f..277af4587 100644
--- a/execution/uc2-workload-generator/deployment.yaml
+++ b/execution/uc2-workload-generator/deployment.yaml
@@ -15,7 +15,7 @@ spec:
       terminationGracePeriodSeconds: 0
       containers:
       - name: workload-generator
-        image: benediktwetzel/uc2-wg:latest 
+        image: benediktwetzel/uc2-wg:latest
         env:
         - name: KAFKA_BOOTSTRAP_SERVERS
           value: "my-confluent-cp-kafka:9092"
@@ -24,5 +24,4 @@ spec:
         - name: NUM_SENSORS
           value: "4"
         - name: NUM_NESTED_GROUPS
-          value: "{{NUM_NESTED_GROUPS}}"
-          
\ No newline at end of file
+          value: 25000
diff --git a/execution/uc2-workload-generator/kustomization.yaml b/execution/uc2-workload-generator/kustomization.yaml
new file mode 100644
index 000000000..17c5d2e19
--- /dev/null
+++ b/execution/uc2-workload-generator/kustomization.yaml
@@ -0,0 +1,12 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonLabels:
+  app: titan-ccp-aggregation
+
+# Use all resources to compose them into one file
+resources:
+  - deployment.yaml
+
+patchesStrategicMerge:
+- set_paramters.yaml # Patch setting the parameters
diff --git a/execution/uc2-workload-generator/set_paramters.yaml b/execution/uc2-workload-generator/set_paramters.yaml
new file mode 100644
index 000000000..835568cc4
--- /dev/null
+++ b/execution/uc2-workload-generator/set_paramters.yaml
@@ -0,0 +1,13 @@
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: titan-ccp-load-generator
+spec:
+  replicas: 1
+  template:
+    spec:
+      containers:
+      - name: workload-generator
+        env:
+        - name: NUM_NESTED_GROUPS
+          value: 25000
diff --git a/execution/uc3-application/aggregation-deployment.yaml b/execution/uc3-application/aggregation-deployment.yaml
index 0f3327af3..23d77086a 100644
--- a/execution/uc3-application/aggregation-deployment.yaml
+++ b/execution/uc3-application/aggregation-deployment.yaml
@@ -25,13 +25,13 @@ spec:
         - name: KAFKA_WINDOW_DURATION_MINUTES
           value: "1"
         - name: COMMIT_INTERVAL_MS
-          value: "{{KAFKA_STREAMS_COMMIT_INTERVAL_MS}}"
+          value: 100
         - 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"
         resources:
           limits:
-            memory: "{{MEMORY_LIMIT}}"
-            cpu: "{{CPU_LIMIT}}"
+            memory: 4Gi
+            cpu: 1000m
       - name: prometheus-jmx-exporter
         image: "solsson/kafka-prometheus-jmx-exporter@sha256:6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143"
         command:
@@ -52,4 +52,4 @@ spec:
       volumes:
         - name: jmx-config
           configMap:
-            name: aggregation-jmx-configmap
\ No newline at end of file
+            name: aggregation-jmx-configmap
diff --git a/execution/uc3-application/kustomization.yaml b/execution/uc3-application/kustomization.yaml
new file mode 100644
index 000000000..ab5c91fbc
--- /dev/null
+++ b/execution/uc3-application/kustomization.yaml
@@ -0,0 +1,15 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonLabels:
+  app: titan-ccp-aggregation
+
+# Use all resources to compose them into one file
+resources:
+  - aggregation-deployment.yaml
+  - aggregation-service.yaml
+  - service-monitor.yaml
+  - jmx-configmap.yaml
+
+patchesStrategicMerge:
+- set_paramters.yaml # Patch setting the resource parameters
diff --git a/execution/uc3-application/set_paramters.yaml b/execution/uc3-application/set_paramters.yaml
new file mode 100644
index 000000000..2738e0c17
--- /dev/null
+++ b/execution/uc3-application/set_paramters.yaml
@@ -0,0 +1,16 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: titan-ccp-aggregation
+spec:
+  template:
+    spec:
+      containers:
+      - name: uc3-application
+        env:
+        - name: COMMIT_INTERVAL_MS
+          value: 100
+        resources:
+          limits:
+            memory: 4Gi
+            cpu: 1000m
diff --git a/execution/uc3-workload-generator/deployment.yaml b/execution/uc3-workload-generator/deployment.yaml
index 9ecd2b67e..c9acb06a9 100644
--- a/execution/uc3-workload-generator/deployment.yaml
+++ b/execution/uc3-workload-generator/deployment.yaml
@@ -7,7 +7,7 @@ spec:
     matchLabels:
       app: titan-ccp-load-generator
   serviceName: titan-ccp-load-generator
-  replicas: {{INSTANCES}}
+  replicas: 1
   template:
     metadata:
       labels:
@@ -16,16 +16,15 @@ spec:
       terminationGracePeriodSeconds: 0
       containers:
       - name: workload-generator
-        image: soerenhenning/uc3-wg:latest 
+        image: soerenhenning/uc3-wg:latest
         env:
         - name: KAFKA_BOOTSTRAP_SERVERS
           value: "my-confluent-cp-kafka:9092"
         - name: NUM_SENSORS
-          value: "{{NUM_SENSORS}}"
+          value: 25000
         - name: POD_NAME
           valueFrom:
             fieldRef:
               fieldPath: metadata.name
         - name: INSTANCES
-          value: "{{INSTANCES}}"
-          
\ No newline at end of file
+          value: 1
diff --git a/execution/uc3-workload-generator/kustomization.yaml b/execution/uc3-workload-generator/kustomization.yaml
new file mode 100644
index 000000000..17c5d2e19
--- /dev/null
+++ b/execution/uc3-workload-generator/kustomization.yaml
@@ -0,0 +1,12 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonLabels:
+  app: titan-ccp-aggregation
+
+# Use all resources to compose them into one file
+resources:
+  - deployment.yaml
+
+patchesStrategicMerge:
+- set_paramters.yaml # Patch setting the parameters
diff --git a/execution/uc3-workload-generator/set_paramters.yaml b/execution/uc3-workload-generator/set_paramters.yaml
new file mode 100644
index 000000000..9d512893f
--- /dev/null
+++ b/execution/uc3-workload-generator/set_paramters.yaml
@@ -0,0 +1,15 @@
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: titan-ccp-load-generator
+spec:
+  replicas: 1
+  template:
+    spec:
+      containers:
+      - name: workload-generator
+        env:
+        - name: NUM_SENSORS
+          value: 25000
+        - name: INSTANCES
+          value: 1
diff --git a/execution/uc4-application/aggregation-deployment.yaml b/execution/uc4-application/aggregation-deployment.yaml
index f7a750c79..be0718266 100644
--- a/execution/uc4-application/aggregation-deployment.yaml
+++ b/execution/uc4-application/aggregation-deployment.yaml
@@ -27,13 +27,13 @@ spec:
         - name: AGGREGATION_DURATION_ADVANCE
           value: "1"
         - name: COMMIT_INTERVAL_MS
-          value: "{{KAFKA_STREAMS_COMMIT_INTERVAL_MS}}"
+          value: 100
         - 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"
         resources:
           limits:
-            memory: "{{MEMORY_LIMIT}}"
-            cpu: "{{CPU_LIMIT}}"
+            memory: 4Gi
+            cpu: 1000m
       - name: prometheus-jmx-exporter
         image: "solsson/kafka-prometheus-jmx-exporter@sha256:6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143"
         command:
@@ -54,4 +54,4 @@ spec:
       volumes:
         - name: jmx-config
           configMap:
-            name: aggregation-jmx-configmap
\ No newline at end of file
+            name: aggregation-jmx-configmap
diff --git a/execution/uc4-application/kustomization.yaml b/execution/uc4-application/kustomization.yaml
new file mode 100644
index 000000000..ab5c91fbc
--- /dev/null
+++ b/execution/uc4-application/kustomization.yaml
@@ -0,0 +1,15 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonLabels:
+  app: titan-ccp-aggregation
+
+# Use all resources to compose them into one file
+resources:
+  - aggregation-deployment.yaml
+  - aggregation-service.yaml
+  - service-monitor.yaml
+  - jmx-configmap.yaml
+
+patchesStrategicMerge:
+- set_paramters.yaml # Patch setting the resource parameters
diff --git a/execution/uc4-application/set_paramters.yaml b/execution/uc4-application/set_paramters.yaml
new file mode 100644
index 000000000..38c80d9ff
--- /dev/null
+++ b/execution/uc4-application/set_paramters.yaml
@@ -0,0 +1,16 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: titan-ccp-aggregation
+spec:
+  template:
+    spec:
+      containers:
+      - name: uc4-application
+        env:
+        - name: COMMIT_INTERVAL_MS
+          value: 100
+        resources:
+          limits:
+            memory: 4Gi
+            cpu: 1000m
diff --git a/execution/uc4-workload-generator/deployment.yaml b/execution/uc4-workload-generator/deployment.yaml
index 6400abc34..8241c734b 100644
--- a/execution/uc4-workload-generator/deployment.yaml
+++ b/execution/uc4-workload-generator/deployment.yaml
@@ -15,10 +15,9 @@ spec:
       terminationGracePeriodSeconds: 0
       containers:
       - name: workload-generator
-        image: soerenhenning/uc4-wg:latest 
+        image: soerenhenning/uc4-wg:latest
         env:
         - name: KAFKA_BOOTSTRAP_SERVERS
           value: "my-confluent-cp-kafka:9092"
         - name: NUM_SENSORS
-          value: "{{NUM_SENSORS}}"
-          
\ No newline at end of file
+          value: 25000
diff --git a/execution/uc4-workload-generator/kustomization.yaml b/execution/uc4-workload-generator/kustomization.yaml
new file mode 100644
index 000000000..17c5d2e19
--- /dev/null
+++ b/execution/uc4-workload-generator/kustomization.yaml
@@ -0,0 +1,12 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonLabels:
+  app: titan-ccp-aggregation
+
+# Use all resources to compose them into one file
+resources:
+  - deployment.yaml
+
+patchesStrategicMerge:
+- set_paramters.yaml # Patch setting the parameters
diff --git a/execution/uc4-workload-generator/set_paramters.yaml b/execution/uc4-workload-generator/set_paramters.yaml
new file mode 100644
index 000000000..9d512893f
--- /dev/null
+++ b/execution/uc4-workload-generator/set_paramters.yaml
@@ -0,0 +1,15 @@
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: titan-ccp-load-generator
+spec:
+  replicas: 1
+  template:
+    spec:
+      containers:
+      - name: workload-generator
+        env:
+        - name: NUM_SENSORS
+          value: 25000
+        - name: INSTANCES
+          value: 1
-- 
GitLab