Skip to content

Commit

Permalink
feat(deployment): Allow detailed customizable resources (#2802)
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson authored Sep 16, 2024
1 parent 3f928af commit 43f81cc
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 64 deletions.
13 changes: 12 additions & 1 deletion kubernetes/loculus/templates/_resources.tpl
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
{{- define "loculus.standardCPURequest" }}{{- if $.Values.reduceResourceRequest }}cpu: "20m"{{- else }}cpu: "100m"{{- end }}{{- end }}
{{- define "loculus.resources" -}}
{{- $args := . -}}
{{- $containerName := index $args 0 -}}
{{- $values := index $args 1 -}}
{{- if and $values.resources (index $values.resources $containerName) }}
resources:
{{ toYaml (index $values.resources $containerName) | indent 2 }}
{{- else if $values.defaultResources }}
resources:
{{ toYaml $values.defaultResources | indent 2 }}
{{- end }}
{{- end }}
7 changes: 1 addition & 6 deletions kubernetes/loculus/templates/docs-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ spec:
- name: docs
image: "ghcr.io/loculus-project/docs:{{ $dockerTag }}"
imagePullPolicy: Always
resources:
requests:
memory: "200Mi"
{{ include "loculus.standardCPURequest" $ }}
limits:
memory: "1Gi"
{{- include "loculus.resources" (list "docs" .Values) | nindent 10 }}
ports:
- containerPort: 8080

Expand Down
7 changes: 1 addition & 6 deletions kubernetes/loculus/templates/ena-submission-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,7 @@ spec:
- name: ena-submission
image: "ghcr.io/loculus-project/ena-submission:{{ $dockerTag }}"
imagePullPolicy: Always
resources:
requests:
memory: "80Mi"
cpu: "10m"
limits:
memory: "10Gi"
{{- include "loculus.resources" (list "ena-submission" $.Values) | nindent 10 }}
env:
- name: EXTERNAL_METADATA_UPDATER_PASSWORD
valueFrom:
Expand Down
8 changes: 1 addition & 7 deletions kubernetes/loculus/templates/ingest-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ spec:
- name: ingest-{{ $key }}
image: {{ $value.ingest.image}}:{{ $dockerTag }}
imagePullPolicy: Always
resources:
requests:
memory: "1Gi"
cpu: "200m"
limits:
cpu: "200m"
memory: "10Gi"
{{- include "loculus.resources" (list "ingest" $.Values) | nindent 10 }}
env:
- name: KEYCLOAK_INGEST_PASSWORD
valueFrom:
Expand Down
7 changes: 1 addition & 6 deletions kubernetes/loculus/templates/keycloak-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ spec:
- name: keycloak
# TODO #1221
image: quay.io/keycloak/keycloak:23.0
resources:
requests:
memory: "500Mi"
cpu: "20m"
limits:
memory: "3Gi"
{{- include "loculus.resources" (list "keycloak" $.Values) | nindent 10 }}
env:
- name: REGISTRATION_TERMS_MESSAGE
value: {{ $.Values.registrationTermsMessage }}
Expand Down
20 changes: 3 additions & 17 deletions kubernetes/loculus/templates/lapis-silo-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ spec:
containers:
- name: silo
image: {{ $.Values.images.lapisSilo }}
resources:
requests:
memory: "100Mi"
cpu: "10m"
limits:
memory: "10Gi"
{{- include "loculus.resources" (list "silo" $.Values) | nindent 10 }}
ports:
- containerPort: 8081
args:
Expand All @@ -43,12 +38,7 @@ spec:
mountPath: /data
- name: lapis
image: {{ $.Values.images.lapis }}
resources:
requests:
memory: "220Mi"
cpu: "30m"
limits:
memory: "5Gi"
{{- include "loculus.resources" (list "lapis" $.Values) | nindent 10 }}
ports:
- containerPort: 8080
args:
Expand Down Expand Up @@ -81,11 +71,7 @@ spec:
- name: silo-preprocessing
image: {{ $.Values.images.lapisSilo }}
imagePullPolicy: IfNotPresent
resources:
limits:
memory: "10Gi"
requests:
memory: "20Mi"
{{- include "loculus.resources" (list "silo-preprocessing" $.Values) | nindent 10 }}
command:
- sh
- -c
Expand Down
7 changes: 1 addition & 6 deletions kubernetes/loculus/templates/loculus-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ spec:
- name: backend
image: "ghcr.io/loculus-project/backend:{{ $dockerTag }}"
imagePullPolicy: Always
resources:
requests:
memory: "640Mi"
cpu: "250m"
limits:
memory: "3Gi" # Backend requires at least 635741K of memory
{{- include "loculus.resources" (list "backend" $.Values) | nindent 10 }}
livenessProbe:
httpGet:
path: "/actuator/health/liveness"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ spec:
- name: preprocessing-{{ $organism }}
image: {{ $processingConfig.image}}:{{ $dockerTag }}
imagePullPolicy: Always
resources:
requests:
memory: "20Mi"
{{ include "loculus.standardCPURequest" $ }}
limits:
memory: "3Gi"
{{- include "loculus.resources" (list "preprocessing" $.Values) | nindent 10 }}
env:
- name: KEYCLOAK_PASSWORD
valueFrom:
Expand Down
7 changes: 1 addition & 6 deletions kubernetes/loculus/templates/loculus-website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ spec:
- name: website
image: "{{ if $.Values.customWebsiteImage }}{{ $.Values.customWebsiteImage }}{{ else }}ghcr.io/loculus-project/website:{{ $dockerTag }}{{ end }}"
imagePullPolicy: Always
resources:
requests:
memory: "200Mi"
{{ include "loculus.standardCPURequest" $ }}
limits:
memory: "1Gi"
{{- include "loculus.resources" (list "website" .Values) | nindent 10 }}
ports:
- containerPort: 3000
volumeMounts:
Expand Down
65 changes: 65 additions & 0 deletions kubernetes/loculus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1489,3 +1489,68 @@ replicas:
website: 1
backend: 1
gitHubEditLink: "https://github.com/loculus-project/loculus/edit/main/monorepo/website/"
resources:
website:
requests:
memory: "200Mi"
limits:
memory: "1Gi"
docs:
requests:
memory: "200Mi"
limits:
memory: "1Gi"
ena-submission:
requests:
memory: "80Mi"
cpu: "10m"
limits:
memory: "10Gi"
ingest:
requests:
memory: "1Gi"
cpu: "200m"
limits:
cpu: "200m"
memory: "10Gi"
keycloak:
requests:
memory: "500Mi"
cpu: "20m"
limits:
memory: "3Gi"
silo:
requests:
memory: "100Mi"
cpu: "10m"
limits:
memory: "10Gi"
lapis:
requests:
memory: "220Mi"
cpu: "30m"
limits:
memory: "5Gi"
silo-preprocessing:
requests:
memory: "20Mi"
limits:
memory: "10Gi"
backend:
requests:
memory: "640Mi"
cpu: "250m"
limits:
memory: "3Gi" # Backend requires at least 635741K of memory
preprocessing:
requests:
memory: "20Mi"
limits:
memory: "3Gi"
defaultResources:
requests:
memory: "200Mi"
cpu: "20m"
limits:
memory: "1Gi"
cpu: "20m"
3 changes: 1 addition & 2 deletions kubernetes/loculus/values_e2e_and_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ secrets:
backendUserPassword: "backend"
createTestAccounts: true
backendExtraArgs:
- "--loculus.debug-mode=true"
reduceResourceRequest: true
- "--loculus.debug-mode=true"
1 change: 0 additions & 1 deletion kubernetes/loculus/values_preview_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ secrets:
encryptedData:
github-username: AgBtyXeimJmI7e1di9ubkzNODtAAlm0LiXEJJGfzzR/KExSrVMYsWcIIQOCfS/bbLvvvSyddKPGeFYhozG6CK943oTJ2rZHeMBjqtXX0AEw655KfJNgHWoWWk1xdmOzITtzKNlHi4cPcxswQte84NhJqRZPJ1sNhQfOm/AwL0NplQXD6xyl7UGAUKOW8rSLgH+gTUsTzmz2prgwiF3SmwwHCSClL/q9H4/nqkMycMQ5NcQK+5cpUUeWidzL3LjANCJS815S8oMdUWbDFwB3NPPfUhYdRuXM19MAHxq2hhAkn6rKGNI8tQhahi8dfmH2QDMyS1KVRof6taBXJIVMxeejL8nOJbNhPBdtyM+3hVasm/frLycUJxzvQpPPv1ictprM5K/r2sJDIqyXVOZSspyXQ09gFz2D13QsOSfaERbKUMtn9L0bfsG3N/zwo614N8YNCXf+dvIjVCoFwMD5RQ5IkqHLPEQiJ77++feSO+4fbfItjMI8qP4mM6YRI7VqweVKufwdSSropRpxhytnjqoWfvHFyDgzsw4ZuJwlyZs01yuJelog4yqG8WszWCv6Ae3fRM3gaquCj2UlFfxTBxN+aZId/lV3LCG1l06g82J6+YTL5wdCnYuYcpZmp21651J9jWwWzCumRWaQgbY6Ou0VjHKZ9if1uDdYA3S7SJJx/ZDZK4cixoS9VXgsPWFgmHbZNHqOFzOd2Dl9kRA==
github-pat: AgBa5wjYBw3GWXihWdoedx3oEbR5z808WoeIGyk5aAZPQ1MTMbWm4ZMdvJUZVPlkRacQXSt+A2pniYMjzl0bqHkc5guVQOoHu6jZgtyfaOyqT4Ergz1+L9VUzyn6E1NwqV2BtdKQTN7A1VvtLw0BLVG0E01SUcHeoU9MWlF+9BWFtXWWYxWL/sTLKoz0tnj8yu6LLHMMYeCnABAoZwZbJ3kf1UVp3FwcJbuSqsrUTPaeS6z5g90jL/zwJ150VUh9kInHs+kwV1imZp06ZUm3gpdY1f/EQZnxHTPUoaYLOo91cEhG7bSD9KQz1B6m07VzjIlnrwduPUCFQs1gk1hU7gO+6MYlMqCIb8NUQbuX5d5cHiENJm9DXAJdd8oNW02JQ371gulVYvXagAdrYgYv75Mr3YjejHZeinZrJ/ZxeZI0+fL4SLkh+77RyuN1R6ab1vGBoUG+LgHsUEBT7mw/wXtrzRmNBwxNBXSfTrrKM+EzM9KUsrSe490sK3Rf4TExjynL/9biS9ZFw601tdBh8luO3xFhCr8Bn4q7sWnKNmvSu+gMZklyhR65Hf0LHTxUdDcK8WZKFyds6foHTAv9kX4+NK7upVfAdjx9Tpf0ONad3nSboi/+1vYoGtAZcL6BZoNL+1Xu2WAlVa+WollJSV2k4KeTEswE1vmPAhoapyxpry9Mz+8CGkohvSPjHGdfXSNSW7K9zKCCubqzHV2+EsnaDWJ9+cwghAQFOpKdbJuHLwalMpAkTztRjr5wHfD6KSo1apCHZl84S0B2u8floEzU1XRiW8zq10m8cb3/xmdteNL3FNMlZlEieD2nsiU=
reduceResourceRequest: true
previewDocs: true
robotsNoindexHeader: true

0 comments on commit 43f81cc

Please sign in to comment.