From 447527ada3516bcb9f646a2626b9d17cbb0ec65b Mon Sep 17 00:00:00 2001
From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de>
Date: Wed, 14 Apr 2021 13:12:26 +0200
Subject: [PATCH] introduce a results/ folder to make it possible to mount a
 volume for that

---
 execution/theodolite-kotlin.yaml                    | 12 +++++++-----
 theodolite-quarkus/src/main/docker/Dockerfile.jvm   |  2 ++
 .../src/main/docker/Dockerfile.native               | 13 +++++++------
 .../theodolite/evaluation/AnalysisExecutor.kt       |  2 +-
 .../theodolite/execution/TheodoliteExecutor.kt      |  6 +++---
 5 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/execution/theodolite-kotlin.yaml b/execution/theodolite-kotlin.yaml
index 6588a101d..25330f588 100644
--- a/execution/theodolite-kotlin.yaml
+++ b/execution/theodolite-kotlin.yaml
@@ -5,10 +5,10 @@ metadata:
 spec:
   template:
     spec:
-      # volumes:
-      # - name: theodolite-pv-storage
-      #   persistentVolumeClaim:
-      #     claimName: theodolite-pv-claim
+      volumes:
+      - name: theodolite-pv-storage
+        persistentVolumeClaim:
+          claimName: theodolite-pv-claim
       containers:
         - name: lag-analysis
           image: ghcr.io/cau-se/theodolite-slo-checker-lag-trend:theodolite-kotlin-latest
@@ -16,7 +16,7 @@ spec:
           - containerPort: 80
             name: analysis
         - name: theodolite
-          image: ghcr.io/cau-se/theodolite:theodolite-kotlin-latest
+          image: benediktwetzel/theodolite-test #ghcr.io/cau-se/theodolite:theodolite-kotlin-latest
           imagePullPolicy: Always
           env:
             - name: NAMESPACE
@@ -36,6 +36,8 @@ spec:
             mountPath: /etc/benchmark
           - name: execution
             mountPath: /etc/execution
+        #  -  name: theodolite-pv-storage
+        #     mountPath: "/deployments"
       restartPolicy: Never
       # Uncomment if RBAC is enabled and configured
       serviceAccountName: theodolite
diff --git a/theodolite-quarkus/src/main/docker/Dockerfile.jvm b/theodolite-quarkus/src/main/docker/Dockerfile.jvm
index 6733d5d44..758358fe4 100644
--- a/theodolite-quarkus/src/main/docker/Dockerfile.jvm
+++ b/theodolite-quarkus/src/main/docker/Dockerfile.jvm
@@ -33,6 +33,8 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
     && microdnf clean all \
     && mkdir /deployments \
     && chown 1001 /deployments \
+    && mkdir deployments/results \
+    && chown 1001 deployments/results \ 
     && chmod "g+rwX" /deployments \
     && chown 1001:root /deployments \
     && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
diff --git a/theodolite-quarkus/src/main/docker/Dockerfile.native b/theodolite-quarkus/src/main/docker/Dockerfile.native
index 37a5a4bd8..7c0f04a01 100644
--- a/theodolite-quarkus/src/main/docker/Dockerfile.native
+++ b/theodolite-quarkus/src/main/docker/Dockerfile.native
@@ -15,12 +15,13 @@
 #
 ###
 FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
-WORKDIR /work/
-RUN chown 1001 /work \
-    && chmod "g+rwX" /work \
-    && chown 1001:root /work
-COPY --chown=1001:root build/*-runner /work/application
-COPY config/ /work/config/
+WORKDIR /deployments
+RUN chown 1001 /deployments \
+    && mkdir results \
+    && chmod "g+rwX" /deployments \
+    && chown 1001:root /deployments
+COPY --chown=1001:root build/*-runner /deployments/application
+COPY config/ /deployments/config/
 
 EXPOSE 8080
 USER 1001
diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt
index e76f6cf34..ddf2c7b5c 100644
--- a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt
+++ b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt
@@ -41,7 +41,7 @@ class AnalysisExecutor(
                 query = "sum by(group)(kafka_consumergroup_group_lag >= 0)"
             )
 
-            CsvExporter().toCsv(name = "$executionId-${load.get()}-${res.get()}-${slo.sloType}", prom = prometheusData)
+            CsvExporter().toCsv(name = "results/$executionId-${load.get()}-${res.get()}-${slo.sloType}", prom = prometheusData)
             val sloChecker = SloCheckerFactory().create(
                 sloType = slo.sloType,
                 externalSlopeURL = slo.externalSloUrl,
diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt
index c2b8cc7d2..e8008a0fd 100644
--- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt
+++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt
@@ -97,8 +97,8 @@ class TheodoliteExecutor(
      * execution and benchmark objects.
      */
     fun run() {
-        storeAsFile(this.config, "${this.config.executionId}-execution-configuration")
-        storeAsFile(kubernetesBenchmark, "${this.config.executionId}-benchmark-configuration")
+        storeAsFile(this.config, "results/${this.config.executionId}-execution-configuration")
+        storeAsFile(kubernetesBenchmark, "results/${this.config.executionId}-benchmark-configuration")
 
         val config = buildConfig()
         // execute benchmarks for each load
@@ -107,7 +107,7 @@ class TheodoliteExecutor(
                 config.compositeStrategy.findSuitableResource(load, config.resources)
             }
         }
-        storeAsFile(config.compositeStrategy.benchmarkExecutor.results, "${this.config.executionId}-result")
+        storeAsFile(config.compositeStrategy.benchmarkExecutor.results, "results/${this.config.executionId}-result")
     }
 
     private fun <T> storeAsFile(saveObject: T, filename: String) {
-- 
GitLab