[PORTAL] Fix Heap config generation 51/117851/2
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Mon, 15 Feb 2021 14:28:19 +0000 (15:28 +0100)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Tue, 16 Feb 2021 07:04:22 +0000 (07:04 +0000)
When tried to apply heap configuration for small flavors, weird side
effects have appeared.
This patch solves them by doing a more generic way of configuring heap
variables for cassandra.

Issue-ID: PORTAL-1037
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: Iebe2edd5281213580d9e1d4d86f9ca0b2abd2601

kubernetes/portal/components/portal-cassandra/templates/deployment.yaml
kubernetes/portal/components/portal-cassandra/values.yaml

index 39cd029..20c396f 100644 (file)
@@ -108,11 +108,15 @@ spec:
             value: rack1
           - name: CASSANDRA_ENABLE_RPC
             value: "true"
-          {{- if eq "small" .Values.flavor }}
+          {{- $flavor := include "common.flavor" . }}
+          {{- $heap := pluck $flavor .Values.heap | first }}
+          {{- if (hasKey $heap "max") }}
           - name: MAX_HEAP_SIZE
-            value: {{ .Values.resources.small.heap.max }}
+            value: {{ $heap.max }}
+          {{- end }}
+          {{- if (hasKey $heap "new") }}
           - name: HEAP_NEWSIZE
-            value: {{ .Values.resources.small.heap.new }}
+            value: {{ $heap.new }}
           {{- end }}
         volumeMounts:
         - mountPath: /etc/localtime
index c185155..b06761a 100644 (file)
@@ -112,14 +112,6 @@ flavor: small
 # Segregation for Different environment (Small and Large)
 resources:
   small:
-    # Heap size is tightly correlated to RAM limits.
-    # If limit > 8G, Cassandra should define itself the best value.
-    # If not, you must set up it in a coherent way with limits set
-    # Refer to https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/operations/opsTuneJVM.html#Determiningtheheapsize
-    # for more informations.
-    heap:
-      max: 3G
-      new: 100M
     limits:
       cpu: 500m
       memory: 3.75Gi
@@ -134,3 +126,15 @@ resources:
       cpu: 2
       memory: 6Gi
   unlimited: {}
+
+heap:
+  # Heap size is tightly correlated to RAM limits.
+  # If limit > 8G, Cassandra should define itself the best value.
+  # If not, you must set up it in a coherent way with limits set
+  # Refer to https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/operations/opsTuneJVM.html#Determiningtheheapsize
+  # for more informations.
+  small:
+    max: 3G
+    new: 100M
+  large: {}
+  unlimited: {}
\ No newline at end of file