[COMMON] Add limits to mongo statefulsets. 38/113038/3
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Wed, 23 Sep 2020 08:39:31 +0000 (10:39 +0200)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Wed, 23 Sep 2020 12:27:04 +0000 (12:27 +0000)
Having limits is important in order to have safe deployment.
mongo didn't had one so let's add them.

Issue-ID: OOM-2230
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I4791b924693e4e1eaac14077d4f30e3d29228779

kubernetes/common/mongo/templates/statefulset.yaml
kubernetes/common/mongo/values.yaml

index abc71b3..df922ed 100644 (file)
@@ -71,8 +71,7 @@ spec:
           volumeMounts:
           - name: {{ include "common.fullname" . }}-data
             mountPath: /var/lib/mongo
-          resources:
-{{ include "common.resources" . | indent 12 }}
+          resources: {{ include "common.resources" . | nindent 12 }}
 {{ include "common.containerSecurityContext" . | indent 10 }}
         {{- if .Values.nodeSelector }}
         nodeSelector:
index d8988c3..b21b0bf 100644 (file)
@@ -90,7 +90,6 @@ securityContext:
 ingress:
   enabled: false
 
-resources: {}
   # We usually recommend not to specify default resources and to leave this as a conscious
   # choice for the user. This also increases chances charts run on environments with little
   # resources, such as Minikube. If you do want to specify resources, uncomment the following
@@ -101,13 +100,22 @@ resources: {}
   # ref: http://kubernetes.io/docs/user-guide/compute-resources/
   # Minimum memory for development is 2 CPU cores and 4GB memory
   # Minimum memory for production is 4 CPU cores and 8GB memory
-#resources:
-#  limits:
-#    cpu: 2
-#    memory: 4Gi
-#  requests:
-#    cpu: 2
-#    memory: 4Gi
+resources:
+  small:
+    limits:
+      cpu: 100m
+      memory: 200Mi
+    requests:
+      cpu: 10m
+      memory: 50Mi
+  large:
+    limits:
+      cpu: 2
+      memory: 4Gi
+    requests:
+      cpu: 1
+      memory: 2Gi
+  unlimited: {}
 
 sdnctlPrefix: mongo