Support custom envs for Action DinD container (#722)

Follow-up to https://gitea.com/gitea/helm-chart/pulls/666.

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/722
Co-authored-by: justusbunsi <sk.bunsenbrenner@gmail.com>
Co-committed-by: justusbunsi <sk.bunsenbrenner@gmail.com>
This commit is contained in:
justusbunsi 2024-11-10 14:02:15 +00:00 committed by justusbunsi
parent f7c66c0336
commit 7b892431d6
4 changed files with 26 additions and 0 deletions

View File

@ -1028,6 +1028,7 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
| `actions.statefulset.dind.repository` | The Docker-in-Docker image | `docker` |
| `actions.statefulset.dind.tag` | The Docker-in-Docker image tag | `25.0.2-dind` |
| `actions.statefulset.dind.pullPolicy` | The Docker-in-Docker pullPolicy | `IfNotPresent` |
| `actions.statefulset.dind.extraEnvs` | Allows adding custom environment variables, such as `DOCKER_IPTABLES_LEGACY` | `[]` |
| `actions.provisioning.enabled` | Create a job that will create and save the token in a Kubernetes Secret | `false` |
| `actions.provisioning.annotations` | Job's annotations | `{}` |
| `actions.provisioning.labels` | Job's labels | `{}` |

View File

@ -77,6 +77,9 @@ spec:
value: "1"
- name: DOCKER_CERT_PATH
value: /certs/server
{{- if .Values.actions.statefulset.dind.extraEnvs }}
{{- toYaml .Values.actions.statefulset.dind.extraEnvs | nindent 12 }}
{{- end }}
securityContext:
privileged: true
resources:

View File

@ -93,3 +93,19 @@ tests:
value:
name: GITEA_INSTANCE_URL
value: "http://git.example.com"
- it: allows adding custom environment variables to the docker-in-docker container
template: templates/gitea/act_runner/statefulset.yaml
set:
actions:
enabled: true
statefulset:
dind:
extraEnvs:
- name: "CUSTOM_ENV_NAME"
value: "custom env value"
asserts:
- equal:
path: spec.template.spec.containers[1].env[3]
value:
name: "CUSTOM_ENV_NAME"
value: "custom env value"

View File

@ -368,6 +368,7 @@ signing:
## @param actions.statefulset.dind.repository The Docker-in-Docker image
## @param actions.statefulset.dind.tag The Docker-in-Docker image tag
## @param actions.statefulset.dind.pullPolicy The Docker-in-Docker pullPolicy
## @param actions.statefulset.dind.extraEnvs Allows adding custom environment variables, such as `DOCKER_IPTABLES_LEGACY`
## @param actions.provisioning.enabled Create a job that will create and save the token in a Kubernetes Secret
## @param actions.provisioning.annotations Job's annotations
## @param actions.provisioning.labels Job's labels
@ -409,6 +410,11 @@ actions:
repository: docker
tag: 25.0.2-dind
pullPolicy: IfNotPresent
# If the container keeps crashing in your environment, you might have to add the `DOCKER_IPTABLES_LEGACY` environment variable.
# See https://github.com/docker-library/docker/issues/463#issuecomment-1881909456
extraEnvs: []
# - name: "DOCKER_IPTABLES_LEGACY"
# value: "1"
init:
image: