From 0d77c0843d609d545bc470fdd9dfe3c09fe9ca05 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Wed, 31 Jan 2024 11:53:39 +0100 Subject: [PATCH] Increasing the resources for Production MongoDB. --- helm/mongodb/Chart.yaml | 4 +- helm/mongodb/templates/deployment.yaml | 79 ++++++++++++++++++-------- helm/mongodb/values.yaml | 29 +++++++--- 3 files changed, 76 insertions(+), 36 deletions(-) diff --git a/helm/mongodb/Chart.yaml b/helm/mongodb/Chart.yaml index 4aee754d6..4cb2b857d 100644 --- a/helm/mongodb/Chart.yaml +++ b/helm/mongodb/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: mongodb description: A Helm chart for launching a MongoDB ReplicaSet with 3 instances type: application -version: 1.0.8 -appVersion: 1.0.8 +version: 1.0.9 +appVersion: 1.0.9 diff --git a/helm/mongodb/templates/deployment.yaml b/helm/mongodb/templates/deployment.yaml index c0bff0abb..5869da76c 100644 --- a/helm/mongodb/templates/deployment.yaml +++ b/helm/mongodb/templates/deployment.yaml @@ -55,15 +55,27 @@ spec: - image: {{.Values.quickSetting.image.mongodb}} name: {{.Values.db.instance0.podName}} imagePullPolicy: Always + {{- if (eq (toString $environment) "prod") }} + resources: + requests: + ephemeral-storage: {{.Values.db.pod.prod.resources.requests.ephemeralStorage}} + cpu: {{.Values.db.pod.prod.resources.requests.cpu}} + memory: {{.Values.db.pod.prod.resources.requests.memory}} + limits: + ephemeral-storage: {{.Values.db.pod.prod.resources.limits.ephemeralStorage}} + cpu: {{.Values.db.pod.prod.resources.requests.cpu}} + memory: {{.Values.db.pod.prod.resources.limits.memory}} + {{- else }} resources: requests: - ephemeral-storage: {{.Values.db.pod.resources.requests.ephemeralStorage}} - cpu: {{.Values.db.pod.resources.requests.cpu}} - memory: {{.Values.db.pod.resources.requests.memory}} + ephemeral-storage: {{.Values.db.pod.preprod.resources.requests.ephemeralStorage}} + cpu: {{.Values.db.pod.preprod.resources.requests.cpu}} + memory: {{.Values.db.pod.preprod.resources.requests.memory}} limits: - ephemeral-storage: {{.Values.db.pod.resources.limits.ephemeralStorage}} - cpu: {{.Values.db.pod.resources.requests.cpu}} - memory: {{.Values.db.pod.resources.limits.memory}} + ephemeral-storage: {{.Values.db.pod.preprod.resources.limits.ephemeralStorage}} + cpu: {{.Values.db.pod.preprod.resources.requests.cpu}} + memory: {{.Values.db.pod.preprod.resources.limits.memory}} + {{- end }} env: - name: "ENVIRONMENT" value: {{ (toString $environment) }} @@ -183,22 +195,27 @@ spec: - image: {{.Values.quickSetting.image.mongodb}} name: {{.Values.db.instance1.podName}} imagePullPolicy: Always + {{- if (eq (toString $environment) "prod") }} resources: requests: - ephemeral-storage: {{.Values.db.pod.resources.requests.ephemeralStorage}} - cpu: {{.Values.db.pod.resources.requests.cpu}} - memory: {{.Values.db.pod.resources.requests.memory}} + ephemeral-storage: {{.Values.db.pod.prod.resources.requests.ephemeralStorage}} + cpu: {{.Values.db.pod.prod.resources.requests.cpu}} + memory: {{.Values.db.pod.prod.resources.requests.memory}} limits: - ephemeral-storage: {{.Values.db.pod.resources.limits.ephemeralStorage}} - cpu: {{.Values.db.pod.resources.requests.cpu}} - memory: {{.Values.db.pod.resources.limits.memory}} - env: - - name: "ENVIRONMENT" - value: {{ (toString $environment) }} - - name: "RS_NAME" - value: {{.Values.db.rsname}} - - name: "MONGODB_ID" - value: {{.Values.db.instance1.mongoId | quote}} + ephemeral-storage: {{.Values.db.pod.prod.resources.limits.ephemeralStorage}} + cpu: {{.Values.db.pod.prod.resources.requests.cpu}} + memory: {{.Values.db.pod.prod.resources.limits.memory}} + {{- else }} + resources: + requests: + ephemeral-storage: {{.Values.db.pod.preprod.resources.requests.ephemeralStorage}} + cpu: {{.Values.db.pod.preprod.resources.requests.cpu}} + memory: {{.Values.db.pod.preprod.resources.requests.memory}} + limits: + ephemeral-storage: {{.Values.db.pod.preprod.resources.limits.ephemeralStorage}} + cpu: {{.Values.db.pod.preprod.resources.requests.cpu}} + memory: {{.Values.db.pod.preprod.resources.limits.memory}} + {{- end }} livenessProbe: exec: command: @@ -282,15 +299,27 @@ spec: - image: {{.Values.quickSetting.image.mongodb}} name: {{.Values.db.instance2.podName}} imagePullPolicy: Always + {{- if (eq (toString $environment) "prod") }} resources: requests: - ephemeral-storage: {{.Values.db.pod.resources.requests.ephemeralStorage}} - cpu: {{.Values.db.pod.resources.requests.cpu}} - memory: {{.Values.db.pod.resources.requests.memory}} + ephemeral-storage: {{.Values.db.pod.prod.resources.requests.ephemeralStorage}} + cpu: {{.Values.db.pod.prod.resources.requests.cpu}} + memory: {{.Values.db.pod.prod.resources.requests.memory}} limits: - ephemeral-storage: {{.Values.db.pod.resources.limits.ephemeralStorage}} - cpu: {{.Values.db.pod.resources.requests.cpu}} - memory: {{.Values.db.pod.resources.limits.memory}} + ephemeral-storage: {{.Values.db.pod.prod.resources.limits.ephemeralStorage}} + cpu: {{.Values.db.pod.prod.resources.requests.cpu}} + memory: {{.Values.db.pod.prod.resources.limits.memory}} + {{- else }} + resources: + requests: + ephemeral-storage: {{.Values.db.pod.preprod.resources.requests.ephemeralStorage}} + cpu: {{.Values.db.pod.preprod.resources.requests.cpu}} + memory: {{.Values.db.pod.preprod.resources.requests.memory}} + limits: + ephemeral-storage: {{.Values.db.pod.preprod.resources.limits.ephemeralStorage}} + cpu: {{.Values.db.pod.preprod.resources.requests.cpu}} + memory: {{.Values.db.pod.preprod.resources.limits.memory}} + {{- end }} env: - name: "ENVIRONMENT" value: {{ (toString $environment) }} diff --git a/helm/mongodb/values.yaml b/helm/mongodb/values.yaml index f64c6eaba..248392fd8 100644 --- a/helm/mongodb/values.yaml +++ b/helm/mongodb/values.yaml @@ -35,15 +35,26 @@ db: service: port: 27017 pod: - resources: - requests: - ephemeralStorage: "1Gi" - cpu: "100m" - memory: "1Gi" - limits: - ephemeralStorage: "2Gi" - cpu: "200m" - memory: "2Gi" + prod: + resources: + requests: + ephemeralStorage: "1Gi" + cpu: "1000m" + memory: "3Gi" + limits: + ephemeralStorage: "2Gi" + cpu: "3000m" + memory: "8Gi" + preprod: + resources: + requests: + ephemeralStorage: "1Gi" + cpu: "100m" + memory: "1Gi" + limits: + ephemeralStorage: "2Gi" + cpu: "200m" + memory: "2Gi" probes: livenessProbe: initialDelaySeconds: 90