feat: add per-container resource configuration for runner and DinD #160 (#168)

This a correction that is forf from original work of [anders.eficode](https://gitea.com/anders.eficode) on [pull request #160](https://gitea.com/gitea/helm-actions/pulls/160)
Description of the change
Adds statefulset.dind.resources and statefulset.runner.resources as optional per-container resource overrides. When set, each takes precedence over the shared statefulset.resources for that container. When unset (default {}), statefulset.resources is used as before.

Benefits
The DinD sidecar and the runner container have very different resource profiles — DinD is memory-hungry (image layer cache, concurrent builds, image pulls) while the runner is a lightweight coordinator that is mostly idle between jobs. Separate resource limits allow right-sizing each container independently, avoiding the choice between over-provisioning the runner or under-provisioning DinD.

Possible drawbacks
None. Fully backward-compatible — both new values default to {}, causing the shared statefulset.resources fallback to apply exactly as before.

Checklist
- [x] Parameters are documented in the `values.yaml` and added to the `README.md` using [readme-generator-for-helm](https://github.com/bitnami-labs/readme-generator-for-helm)
- [x] Breaking changes are documented in the `README.md`
- [x] Helm templating unittests are added (required when changing anything in `templates` folder)
- [x] Bash unittests are added (required when changing anything in `scripts` folder)
- [x] All added template resources MUST render a namespace in metadata

---------

Co-authored-by: Le Prévost-Corvellec Arnault <arnault.le.prevost.corvellec@carbon-it.com>
Co-authored-by: Anders <lantzanders@gmail.com>
Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/168
Reviewed-by: DaanSelen <135789+daanselen@noreply.gitea.com>
Co-authored-by: Arnault_LPC <194310+arnault_lpc@noreply.gitea.com>
This commit is contained in:
Arnault_LPC
2026-07-21 06:41:06 +00:00
committed by DaanSelen
parent 37080c6548
commit 6537bdbd33
7 changed files with 323 additions and 42 deletions
+82
View File
@@ -451,3 +451,85 @@ tests:
- equal:
path: spec.template.spec.initContainers[0].image
value: test.io/busybox:1.37.0
#
## RESOURCES
#
- it: shared statefulset.resources applies to both runner and dind containers
template: templates/statefulset.yaml
set:
enabled: true
statefulset.resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1Gi"
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1Gi"
- equal:
path: spec.template.spec.initContainers[1].resources
value:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1Gi"
- it: statefulset.runner.resources overrides shared resources for runner container only
template: templates/statefulset.yaml
set:
enabled: true
statefulset.resources:
requests:
memory: "512Mi"
statefulset.runner.resources:
requests:
memory: "256Mi"
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: "256Mi"
- equal:
path: spec.template.spec.initContainers[1].resources
value:
requests:
memory: "512Mi"
- it: statefulset.dind.resources overrides shared resources for dind container only
template: templates/statefulset.yaml
set:
enabled: true
statefulset.resources:
requests:
memory: "512Mi"
statefulset.dind.resources:
requests:
memory: "4Gi"
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: "512Mi"
- equal:
path: spec.template.spec.initContainers[1].resources
value:
requests:
memory: "4Gi"