From 476593d1a33372dd1463480c60b8bea78a488eaa Mon Sep 17 00:00:00 2001 From: Daan Selen Date: Wed, 8 Apr 2026 09:22:44 +0000 Subject: [PATCH] feat: add hostAliases injection (#122) Fix: https://gitea.com/gitea/helm-actions/issues/87 --------- Co-authored-by: DaanSelen Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/122 Co-authored-by: Daan Selen Co-committed-by: Daan Selen --- README.md | 9 +++++---- templates/statefulset.yaml | 6 ++++++ values.yaml | 19 +++++++++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e8f2925..2ac5b3f 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,10 @@ If `.Values.statefulset.dind.rootless: true` is set, then the following will be | `statefulset.tolerations` | Tolerations for the statefulset | `[]` | | `statefulset.affinity` | Affinity for the statefulset | `{}` | | `statefulset.extraVolumes` | Extra volumes for the statefulset | `[]` | +| `statefulset.persistence.size` | Size for persistence to store act runner data | `1Gi` | +| `statefulset.securityContext` | Customize the SecurityContext | `{}` | +| `statefulset.serviceAccountName` | Customize the service account name | `""` | +| `statefulset.hostAliases` | Inject entries into the /etc/hosts file | `[]` | | `statefulset.actRunner.registry` | image registry, e.g. gcr.io,docker.io | `docker.gitea.com` | | `statefulset.actRunner.repository` | The Gitea act runner image | `act_runner` | | `statefulset.actRunner.tag` | The Gitea act runner tag | `0.3.0` | @@ -75,10 +79,10 @@ If `.Values.statefulset.dind.rootless: true` is set, then the following will be | `statefulset.actRunner.fullOverride` | Completely overrides the image registry, path/image, tag and digest. | `""` | | `statefulset.actRunner.extraVolumeMounts` | Allows mounting extra volumes in the act runner container | `[]` | | `statefulset.actRunner.config` | Act runner custom configuration. See [Act Runner documentation](https://docs.gitea.com/usage/actions/act-runner#configuration) for details. | `Too complex. See values.yaml` | +| `statefulset.actRunner.extraEnvs` | Allows adding custom environment variables | `[]` | | `statefulset.dind.rootless` | a simple flag to let helm know we are dealing with a rootless dind container | `false` | | `statefulset.dind.uid` | a field to set the running user id for the rootless dind container, so it knows where to look for the socket | `""` | | `statefulset.dind.registry` | image registry, e.g. gcr.io,docker.io | `docker.io` | -| `statefulset.actRunner.extraEnvs` | Allows adding custom environment variables | `[]` | | `statefulset.dind.repository` | The Docker-in-Docker image | `docker` | | `statefulset.dind.tag` | The Docker-in-Docker image tag | `29.3.1-dind` | | `statefulset.dind.digest` | Image digest. Allows to pin the given image tag. Useful for having control over mutable tags like `latest` | `""` | @@ -86,9 +90,6 @@ If `.Values.statefulset.dind.rootless: true` is set, then the following will be | `statefulset.dind.pullPolicy` | The Docker-in-Docker pullPolicy | `IfNotPresent` | | `statefulset.dind.extraVolumeMounts` | Allows mounting extra volumes in the Docker-in-Docker container | `[]` | | `statefulset.dind.extraEnvs` | Allows adding custom environment variables, such as `DOCKER_IPTABLES_LEGACY` | `[]` | -| `statefulset.persistence.size` | Size for persistence to store act runner data | `1Gi` | -| `statefulset.securityContext` | Customize the SecurityContext | `{}` | -| `statefulset.serviceAccountName` | Customize the service account name | `""` | ### Gitea Actions Init diff --git a/templates/statefulset.yaml b/templates/statefulset.yaml index 67fe2db..92d90f6 100644 --- a/templates/statefulset.yaml +++ b/templates/statefulset.yaml @@ -34,8 +34,14 @@ spec: {{- if .Values.statefulset.serviceAccountName }} serviceAccountName: {{ .Values.statefulset.serviceAccountName }} {{- end }} + {{- if .Values.statefulset.securityContext }} securityContext: {{- toYaml .Values.statefulset.securityContext | nindent 8 }} + {{- end }} + {{- if .Values.statefulset.hostAliases }} + hostAliases: + {{- toYaml .Values.statefulset.hostAliases | nindent 8 }} + {{- end }} initContainers: {{- if .Values.preExtraInitContainers }} {{- toYaml .Values.preExtraInitContainers | nindent 8 }} diff --git a/values.yaml b/values.yaml index 015b639..54e4856 100644 --- a/values.yaml +++ b/values.yaml @@ -11,6 +11,11 @@ ## @param statefulset.tolerations Tolerations for the statefulset ## @param statefulset.affinity Affinity for the statefulset ## @param statefulset.extraVolumes Extra volumes for the statefulset +## @param statefulset.persistence.size Size for persistence to store act runner data +## @param statefulset.securityContext Customize the SecurityContext +## @param statefulset.serviceAccountName Customize the service account name +## @param statefulset.hostAliases Inject entries into the /etc/hosts file +# ## @param statefulset.actRunner.registry image registry, e.g. gcr.io,docker.io ## @param statefulset.actRunner.repository The Gitea act runner image ## @param statefulset.actRunner.tag The Gitea act runner tag @@ -19,10 +24,11 @@ ## @param statefulset.actRunner.fullOverride Completely overrides the image registry, path/image, tag and digest. ## @param statefulset.actRunner.extraVolumeMounts Allows mounting extra volumes in the act runner container ## @param statefulset.actRunner.config [default: Too complex. See values.yaml] Act runner custom configuration. See [Act Runner documentation](https://docs.gitea.com/usage/actions/act-runner#configuration) for details. +## @param statefulset.actRunner.extraEnvs Allows adding custom environment variables +# ## @param statefulset.dind.rootless [default: false] a simple flag to let helm know we are dealing with a rootless dind container ## @param statefulset.dind.uid a field to set the running user id for the rootless dind container, so it knows where to look for the socket ## @param statefulset.dind.registry image registry, e.g. gcr.io,docker.io -## @param statefulset.actRunner.extraEnvs Allows adding custom environment variables ## @param statefulset.dind.repository The Docker-in-Docker image ## @param statefulset.dind.tag The Docker-in-Docker image tag ## @param statefulset.dind.digest Image digest. Allows to pin the given image tag. Useful for having control over mutable tags like `latest` @@ -30,9 +36,6 @@ ## @param statefulset.dind.pullPolicy The Docker-in-Docker pullPolicy ## @param statefulset.dind.extraVolumeMounts Allows mounting extra volumes in the Docker-in-Docker container ## @param statefulset.dind.extraEnvs Allows adding custom environment variables, such as `DOCKER_IPTABLES_LEGACY` -## @param statefulset.persistence.size Size for persistence to store act runner data -## @param statefulset.securityContext Customize the SecurityContext -## @param statefulset.serviceAccountName Customize the service account name enabled: false statefulset: replicas: 1 @@ -47,6 +50,14 @@ statefulset: securityContext: {} serviceAccountName: "" + # Add /etc/hosts injections into the pods + hostAliases: + [] + # - ip: 8.8.8.8 + # hostnames: + # - googel.com + # - googol.com + actRunner: registry: "docker.gitea.com" repository: act_runner