diff --git a/charts/substra-backend/templates/deployment-api-events.yaml b/charts/substra-backend/templates/deployment-api-events.yaml index eb0b5df7e..5dd1b176d 100644 --- a/charts/substra-backend/templates/deployment-api-events.yaml +++ b/charts/substra-backend/templates/deployment-api-events.yaml @@ -41,6 +41,7 @@ spec: - name: api-event-app image: {{ include "substra-backend.images.name" (dict "img" .Values.api.events.image "defaultTag" $.Chart.AppVersion) }} imagePullPolicy: {{ .Values.api.events.image.pullPolicy }} + {{- if .Values.requestsResources }} resources: requests: memory: "200Mi" @@ -48,6 +49,7 @@ spec: limits: memory: "400Mi" cpu: "500m" + {{- end }} command: ["/bin/bash"] {{- if eq .Values.settings "prod" }} args: ["-c", "python manage.py consume"] diff --git a/charts/substra-backend/templates/deployment-registry-prepopulate.yaml b/charts/substra-backend/templates/deployment-registry-prepopulate.yaml index b52c58f5f..6ba6f581c 100644 --- a/charts/substra-backend/templates/deployment-registry-prepopulate.yaml +++ b/charts/substra-backend/templates/deployment-registry-prepopulate.yaml @@ -23,21 +23,25 @@ spec: initContainers: - name: wait-registry image: jwilder/dockerize:0.6.1 + {{- if .Values.requestsResources }} resources: requests: memory: "200Mi" cpu: "500m" limits: memory: "400Mi" + {{- end }} command: ['dockerize', '-wait', 'tcp://{{ $.Release.Name }}-docker-registry:5000'] - name: kaniko image: {{ include "common.images.name" $.Values.kaniko.image }} + {{- if .Values.requestsResources }} resources: requests: memory: "2Gi" cpu: "1000m" limits: memory: "8Gi" + {{- end }} args: - "--context=/docker-context" {{- if .dstImage }} @@ -60,12 +64,14 @@ spec: containers: - image: gcr.io/google-containers/pause:3.2 name: pause + {{- if .Values.requestsResources }} resources: requests: memory: "64Mi" cpu: "50m" limits: memory: "128Mi" + {{- end }} volumes: - name: kaniko-dir emptyDir: {} diff --git a/charts/substra-backend/templates/deployment-scheduler-worker.yaml b/charts/substra-backend/templates/deployment-scheduler-worker.yaml index 9fe073ab0..e5c16dede 100644 --- a/charts/substra-backend/templates/deployment-scheduler-worker.yaml +++ b/charts/substra-backend/templates/deployment-scheduler-worker.yaml @@ -77,8 +77,15 @@ spec: - mountPath: /etc/ssl/certs name: ssl-certs {{- end }} + {{- if .Values.requestsRessources }} resources: - {{- toYaml .Values.schedulerWorker.resources | nindent 12 }} + requests: + cpu: "250m" + memory: "200Mi" + limits: + cpu: "250m" + memory: "400Mi" + {{- end }} initContainers: {{- include "common.addCertInitContainer" . | nindent 8 }} volumes: diff --git a/charts/substra-backend/templates/deployment-scheduler.yaml b/charts/substra-backend/templates/deployment-scheduler.yaml index 54bf225a4..d6c7605aa 100644 --- a/charts/substra-backend/templates/deployment-scheduler.yaml +++ b/charts/substra-backend/templates/deployment-scheduler.yaml @@ -80,8 +80,14 @@ spec: mountPath: /var/substra/orchestrator/tls/client {{ end }} {{ end }} + {{ if .Values.scheduler.requestsRessources }} resources: - {{- toYaml .Values.scheduler.resources | nindent 12 }} + requests: + cpu: "1000m" + memory: "4Gi" + limits: + cpu: "2000m" + memory: "8Gi" volumes: - name: runtime-db emptyDir: {} diff --git a/charts/substra-backend/templates/deployment-server.yaml b/charts/substra-backend/templates/deployment-server.yaml index 534399e16..ae26a5ac0 100644 --- a/charts/substra-backend/templates/deployment-server.yaml +++ b/charts/substra-backend/templates/deployment-server.yaml @@ -138,8 +138,15 @@ spec: successThreshold: {{ .Values.server.readinessProbe.successThreshold }} failureThreshold: {{ .Values.server.readinessProbe.failureThreshold }} {{- end }} + {{- if .Values.server.resources }} resources: - {{- toYaml .Values.server.resources | nindent 12 }} + requests: + cpu: "1000m" + memory: "6Gi" + limits: + cpu: "2000m" + memory: "12Gi" + {{- end }} {{- if .Values.server.metrics.enabled }} - name: metrics-sidecar image: {{ include "substra-backend.images.name" (dict "img" .Values.server.metrics.image "defaultTag" $.Chart.AppVersion) }} diff --git a/charts/substra-backend/templates/deployment-worker-events.yaml b/charts/substra-backend/templates/deployment-worker-events.yaml index aa93b8fb4..33d5d92b0 100644 --- a/charts/substra-backend/templates/deployment-worker-events.yaml +++ b/charts/substra-backend/templates/deployment-worker-events.yaml @@ -41,6 +41,7 @@ spec: - name: worker-event-app image: {{ include "substra-backend.images.name" (dict "img" .Values.worker.events.image "defaultTag" $.Chart.AppVersion) }} imagePullPolicy: {{ .Values.worker.events.image.pullPolicy }} + {{- if .Values.requestsResources}} resources: requests: memory: "200Mi" @@ -48,6 +49,7 @@ spec: limits: memory: "400Mi" cpu: "500m" + {{- end }} command: ["/bin/bash"] {{- if eq .Values.settings "prod" }} args: ["-c", "python manage.py consume"] diff --git a/charts/substra-backend/templates/statefulset-builder.yaml b/charts/substra-backend/templates/statefulset-builder.yaml index 50a100afd..e60f6fbc3 100644 --- a/charts/substra-backend/templates/statefulset-builder.yaml +++ b/charts/substra-backend/templates/statefulset-builder.yaml @@ -179,8 +179,15 @@ spec: mountPath: /var/substra/orchestrator/tls/client {{ end }} {{ end }} + {{- if .Values.requestsRessources }} resources: - {{- toYaml .Values.builder.resources | nindent 12 }} + requests: + cpu: "2000m" + memory: "4Gi" + limits: + cpu: "2000m" + memory: "8Gi" + {{- end }} volumes: {{- if .Values.privateCa.enabled }} - name: ssl-certs diff --git a/charts/substra-backend/templates/statefulset-worker.yaml b/charts/substra-backend/templates/statefulset-worker.yaml index e797e4661..7c2cd6d31 100644 --- a/charts/substra-backend/templates/statefulset-worker.yaml +++ b/charts/substra-backend/templates/statefulset-worker.yaml @@ -137,8 +137,15 @@ spec: mountPath: /var/substra/orchestrator/tls/client {{ end }} {{ end }} + {{- if .Values.requestsRessources }} resources: - {{- toYaml .Values.worker.resources | nindent 12 }} + requests: + cpu: "1000m" + memory: "4Gi" + limits: + cpu: "2000m" + memory: "8Gi" + {{- end }} volumes: {{- if .Values.DataSampleStorageInServerMedia }} - name: data-servermedias diff --git a/charts/substra-backend/values.yaml b/charts/substra-backend/values.yaml index 6596ce55b..b8f4d32c2 100644 --- a/charts/substra-backend/values.yaml +++ b/charts/substra-backend/values.yaml @@ -2,6 +2,9 @@ ## @param settings The settings to use for substra (`prod` or `dev`) ## settings: prod +## @param requestsResources Activate or not the resources requests for the pods (true or false) +## +requestsResources: false ## @param config The configuration to use for substra ## config: {} @@ -172,20 +175,6 @@ server: ## ingressClassName: - ## @param server.resources.requests.cpu Server container cpu request - ## @param server.resources.requests.memory Server container memory request - ## @param server.resources.limits.cpu Server container cpu limit - ## @param server.resources.limits.memory Server container memory limit - ## - resources: - requests: - cpu: "1000m" - memory: "6Gi" - limits: - cpu: "2000m" - memory: "12Gi" - - persistence: ## @param server.persistence.storageClass Specify the _StorageClass_ used to provision the volume. Or the default _StorageClass_ will be used. Set it to `-` to disable dynamic provisioning ## @@ -306,18 +295,6 @@ worker: runAsUser: 1001 runAsGroup: 1001 fsGroup: 1001 - ## @param worker.resources.requests.cpu Worker container cpu request - ## @param worker.resources.requests.memory Worker container memory request - ## @param worker.resources.limits.cpu Worker container cpu limit - ## @param worker.resources.limits.memory Worker container memory limit - ## - resources: - requests: - cpu: "1000m" - memory: "4Gi" - limits: - cpu: "2000m" - memory: "8Gi" ## @param worker.nodeSelector Node labels for pod assignment ## nodeSelector: {} @@ -433,18 +410,6 @@ schedulerWorker: ## @param schedulerWorker.affinity Affinity settings for pod assignment ## affinity: {} - ## @param schedulerWorker.resources.requests.cpu Scheduler container cpu request - ## @param schedulerWorker.resources.requests.memory Scheduler container memory request - ## @param schedulerWorker.resources.limits.cpu Scheduler container cpu limit - ## @param schedulerWorker.resources.limits.memory Scheduler container memory limit - ## - resources: - requests: - cpu: "250m" - memory: "200Mi" - limits: - cpu: "250m" - memory: "400Mi" ## @param schedulerWorker.podSecurityContext.enabled Enable security context ## @param schedulerWorker.podSecurityContext.runAsUser User ID for the pod ## @param schedulerWorker.podSecurityContext.runAsGroup Group ID for the pod @@ -476,18 +441,6 @@ scheduler: tag: null pullPolicy: IfNotPresent pullSecrets: [] - ## @param scheduler.resources.requests.cpu Scheduler container cpu request - ## @param scheduler.resources.requests.memory Scheduler container memory request - ## @param scheduler.resources.limits.cpu Scheduler container cpu limit - ## @param scheduler.resources.limits.memory Scheduler container memory limit - ## - resources: - requests: - cpu: "250m" - memory: "200Mi" - limits: - cpu: "250m" - memory: "400Mi" ## @param scheduler.nodeSelector Node labels for pod assignment ## nodeSelector: {} @@ -552,20 +505,6 @@ builder: runAsGroup: 1001 fsGroup: 1001 - - ## @param builder.resources.requests.cpu Builder container cpu request - ## @param builder.resources.requests.memory Builder container memory request - ## @param builder.resources.limits.cpu Builder container cpu limit - ## @param builder.resources.limits.memory Builder container memory limit - ## - resources: - requests: - cpu: "2000m" - memory: "4Gi" - limits: - cpu: "2000m" - memory: "8Gi" - ## @param builder.nodeSelector Node labels for pod assignment ## nodeSelector: { }