properly set requests and limits for the deployment
All checks were successful
Build and Deploy Staging / build (push) Successful in 39s
Build and Deploy Staging / deploy (push) Successful in 7s

This commit is contained in:
Tobias Brunner 2025-12-11 17:11:06 +01:00
parent cee4b2a8bc
commit ac845b5073
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ
4 changed files with 54 additions and 7 deletions

View file

@ -97,6 +97,32 @@ Then access it with http://localhost:8080/ and the Django admin with http://loca
Deployment files are in the `deployment/kustomize` folder and makes use of [Kustomize](https://kustomize.io/) to account for differences between the deployment stages. Deployment files are in the `deployment/kustomize` folder and makes use of [Kustomize](https://kustomize.io/) to account for differences between the deployment stages.
Stages are configured with overlays in `deployment/kustomize/overlays/$environment`. Stages are configured with overlays in `deployment/kustomize/overlays/$environment`.
### Resource Requests and Limits
Resources are configured to comply with APPUiO Cloud's memory-to-CPU ratio of 4096 MiB/core.
See [APPUiO Cloud documentation](https://docs.appuio.cloud/user/how-to/check-cpu-requests.html) for details.
**Production:**
| Container | CPU Request | Memory Request | CPU Limit | Memory Limit |
|-----------|-------------|----------------|-----------|--------------|
| servala | 500m | 2Gi | 2 | 4Gi |
**Staging:**
| Container | CPU Request | Memory Request | CPU Limit | Memory Limit |
|------------------|-------------|----------------|-----------|--------------|
| servala | 250m | 1Gi | 1 | 2Gi |
| ssh-tunnel-dev | 50m | 204Mi | 100m | 256Mi |
| ssh-tunnel-talos | 50m | 204Mi | 100m | 256Mi |
**Ratio Calculation:**
The ratio is calculated as: `Sum of Memory Requests / Sum of CPU Requests`
- Production: 2048 MiB / 0.5 cores = **4096 MiB/core**
- Staging: (1024 + 204 + 204) MiB / (0.25 + 0.05 + 0.05) cores = 1432 MiB / 0.35 cores = **4091 MiB/core**
### Staging ### Staging
The code is automatically built and deployed on a push to the main branch. The code is automatically built and deployed on a push to the main branch.

View file

@ -21,6 +21,13 @@ spec:
- name: servala - name: servala
image: servala.app.codey.ch/servala/servala-portal:latest image: servala.app.codey.ch/servala/servala-portal:latest
imagePullPolicy: Always imagePullPolicy: Always
resources:
requests:
cpu: 500m
memory: 2Gi
limits:
cpu: 2
memory: 4Gi
ports: ports:
- name: http - name: http
containerPort: 8080 containerPort: 8080

View file

@ -32,10 +32,3 @@ spec:
secretKeyRef: secretKeyRef:
name: portal-storage-creds name: portal-storage-creds
key: AWS_SECRET_ACCESS_KEY key: AWS_SECRET_ACCESS_KEY
resources:
limits:
cpu: 2
memory: 2Gi
requests:
cpu: 500m
memory: 512Mi

View file

@ -7,6 +7,13 @@ spec:
spec: spec:
containers: containers:
- name: servala - name: servala
resources:
requests:
cpu: 250m
memory: 1Gi
limits:
cpu: 1
memory: 2Gi
env: env:
- name: SERVALA_ENVIRONMENT - name: SERVALA_ENVIRONMENT
value: staging value: staging
@ -34,6 +41,13 @@ spec:
key: AWS_SECRET_ACCESS_KEY key: AWS_SECRET_ACCESS_KEY
- name: ssh-tunnel-dev - name: ssh-tunnel-dev
image: servala.app.codey.ch/servala/servala-portal:latest image: servala.app.codey.ch/servala/servala-portal:latest
resources:
requests:
cpu: 50m
memory: 204Mi
limits:
cpu: 100m
memory: 256Mi
command: command:
- "/bin/bash" - "/bin/bash"
- "-c" - "-c"
@ -57,6 +71,13 @@ spec:
key: ssh-private-key key: ssh-private-key
- name: ssh-tunnel-talos - name: ssh-tunnel-talos
image: servala.app.codey.ch/servala/servala-portal:latest image: servala.app.codey.ch/servala/servala-portal:latest
resources:
requests:
cpu: 50m
memory: 204Mi
limits:
cpu: 100m
memory: 256Mi
command: command:
- "/bin/bash" - "/bin/bash"
- "-c" - "-c"