From c10e57d7f7205713fe8d002ab5f7c47b3446068f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de>
Date: Fri, 12 Nov 2021 18:17:23 +0100
Subject: [PATCH] Use emptyDir if no PVC should be created

---
 helm/preconfigs/oci.yaml                         |  6 ++++--
 .../templates/theodolite/results-volume/pvc.yaml | 10 +++++-----
 .../theodolite/theodolite-operator.yaml          | 16 ++++++++--------
 helm/values.yaml                                 | 13 +++++++------
 4 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/helm/preconfigs/oci.yaml b/helm/preconfigs/oci.yaml
index dd070a1d7..35fe5dcf4 100644
--- a/helm/preconfigs/oci.yaml
+++ b/helm/preconfigs/oci.yaml
@@ -1,4 +1,6 @@
 operator:
   resultsVolume:
-    storageClassName: "oci-bv"
-    size: 50Gi # minimal size in OCI
\ No newline at end of file
+    persistent:
+      enabled: true
+      storageClassName: "oci-bv"
+      size: 50Gi # minimal size in OCI
diff --git a/helm/templates/theodolite/results-volume/pvc.yaml b/helm/templates/theodolite/results-volume/pvc.yaml
index 6dda16bc8..26ac56e42 100644
--- a/helm/templates/theodolite/results-volume/pvc.yaml
+++ b/helm/templates/theodolite/results-volume/pvc.yaml
@@ -1,18 +1,18 @@
-{{- if and .Values.operator.resultsVolume.enabled (not .Values.operator.resultsVolume.existingClaim) -}}
+{{- if and .Values.operator.resultsVolume.persistent.enabled (not .Values.operator.resultsVolume.persistent.existingClaim) -}}
 apiVersion: v1
 kind: PersistentVolumeClaim
 metadata:
   name: {{ include "theodolite.resultsClaimName" . }}
 spec:
-  {{- if .Values.operator.resultsVolume.storageClassName }}
-  storageClassName: {{ .Values.operator.resultsVolume.storageClassName }}
+  {{- if .Values.operator.resultsVolume.persistent.storageClassName }}
+  storageClassName: {{ .Values.operator.resultsVolume.persistent.storageClassName }}
   {{- end }}
   accessModes:
     - ReadWriteOnce
-    {{- range .Values.operator.resultsVolume.accessModes }}
+    {{- range .Values.operator.resultsVolume.persistent.accessModes }}
     - {{ . | quote }}
     {{- end }}
   resources:
     requests:
-      storage: {{ .Values.operator.resultsVolume.size | quote }}
+      storage: {{ .Values.operator.resultsVolume.persistent.size | quote }}
 {{- end }}
\ No newline at end of file
diff --git a/helm/templates/theodolite/theodolite-operator.yaml b/helm/templates/theodolite/theodolite-operator.yaml
index 52ddcd500..3d1d18630 100644
--- a/helm/templates/theodolite/theodolite-operator.yaml
+++ b/helm/templates/theodolite/theodolite-operator.yaml
@@ -31,10 +31,8 @@ spec:
             - name: RESULTS_FOLDER
               value: "./results"
           volumeMounts:
-            {{- if .Values.operator.resultsVolume.enabled }}
-            - name: theodolite-pv-storage
+            - name: theodolite-results-volume
               mountPath: "/deployments/results"
-            {{- end }}
             - name: benchmark-resources-uc1-kstreams
               mountPath: /deployments/benchmark-resources/uc1-kstreams
             - name: benchmark-resources-uc2-kstreams
@@ -77,7 +75,7 @@ spec:
           - name: LOG_LEVEL
             value: INFO
         {{- end }}
-        {{- if and .Values.operator.resultsVolume.enabled .Values.operator.resultsVolume.accessSidecar.enabled }}
+        {{- if .Values.operator.resultsVolume.accessSidecar.enabled }}
         - name: results-access
           image: busybox:stable
           image: "{{ .Values.operator.resultsVolume.accessSidecar.image }}:{{ .Values.operator.resultsVolume.accessSidecar.imageTag }}"
@@ -88,14 +86,16 @@ spec:
           - exec tail -f /dev/null
           volumeMounts:
           - mountPath: /results
-            name: theodolite-pv-storage
+            name: theodolite-results-volume
         {{- end }}
       volumes:
-      {{- if .Values.operator.resultsVolume.enabled }}
-      - name: theodolite-pv-storage
+      - name: theodolite-results-volume
+        {{- if .Values.operator.resultsVolume.persistent.enabled }}
         persistentVolumeClaim:
           claimName: {{ include "theodolite.resultsClaimName" . | quote }}
-      {{- end }}
+        {{- else }}
+        emptyDir: {}
+        {{- end }}
       - name: benchmark-resources-uc1-kstreams
         configMap:
           name: benchmark-resources-uc1-kstreams
diff --git a/helm/values.yaml b/helm/values.yaml
index b0ce0faea..c45e62aed 100644
--- a/helm/values.yaml
+++ b/helm/values.yaml
@@ -263,12 +263,13 @@ operator:
       imagePullPolicy: Always
 
   resultsVolume:
-    enabled: true
-    # existingClaim:
-    # storageClassName:
-    accessModes:
-      - ReadWriteOnce
-    size: 1Gi
+    persistent:
+      enabled: false
+      # existingClaim:
+      # storageClassName:
+      accessModes:
+        - ReadWriteOnce
+      size: 1Gi
     accessSidecar:
       enabled: true
       image: busybox
-- 
GitLab