Skip to content

Commit

Permalink
chore: ressources in template
Browse files Browse the repository at this point in the history
Signed-off-by: ThibaultFy <thibault.fouqueray@gmail.com>
  • Loading branch information
ThibaultFy committed Apr 24, 2024
1 parent e6d0292 commit 68fe33d
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 69 deletions.
2 changes: 2 additions & 0 deletions charts/substra-backend/templates/deployment-api-events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ 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"
cpu: "500m"
limits:
memory: "400Mi"
cpu: "500m"
{{- end }}
command: ["/bin/bash"]
{{- if eq .Values.settings "prod" }}
args: ["-c", "python manage.py consume"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion charts/substra-backend/templates/deployment-scheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down
9 changes: 8 additions & 1 deletion charts/substra-backend/templates/deployment-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ 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"
cpu: "500m"
limits:
memory: "400Mi"
cpu: "500m"
{{- end }}
command: ["/bin/bash"]
{{- if eq .Values.settings "prod" }}
args: ["-c", "python manage.py consume"]
Expand Down
9 changes: 8 additions & 1 deletion charts/substra-backend/templates/statefulset-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion charts/substra-backend/templates/statefulset-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
67 changes: 3 additions & 64 deletions charts/substra-backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down Expand Up @@ -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
##
Expand Down Expand Up @@ -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: {}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: {}
Expand Down Expand Up @@ -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: { }
Expand Down

0 comments on commit 68fe33d

Please sign in to comment.