diff --git a/README.md b/README.md index e8c28f5..c519bd2 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ You should be good to go! | `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 | `""` | | `existingSecret` | Secret that contains the token | `""` | | `existingSecretKey` | Secret key | `""` | | `giteaRootURL` | URL the act_runner registers and connect with | `""` | diff --git a/templates/statefulset.yaml b/templates/statefulset.yaml index 1541ed8..2c441d7 100644 --- a/templates/statefulset.yaml +++ b/templates/statefulset.yaml @@ -31,6 +31,9 @@ spec: {{- end }} spec: restartPolicy: Always + {{- if .Values.statefulset.serviceAccountName }} + serviceAccountName: {{ .Values.statefulset.serviceAccountName }} + {{- end }} securityContext: {{- toYaml .Values.statefulset.securityContext | nindent 8 }} initContainers: diff --git a/unittests/helm/statefulset.yaml b/unittests/helm/statefulset.yaml index 119e14e..5e8ffdb 100644 --- a/unittests/helm/statefulset.yaml +++ b/unittests/helm/statefulset.yaml @@ -488,3 +488,15 @@ tests: echo "Trying again in 3 seconds..." done echo "Gitea has been reached!" + - it: should render service account name correctly + template: templates/statefulset.yaml + set: + enabled: true + statefulset: + serviceAccountName: "my-service-account" + asserts: + - hasDocuments: + count: 1 + - equal: + path: spec.template.spec.serviceAccountName + value: "my-service-account" diff --git a/values.yaml b/values.yaml index de022b4..ad6a004 100644 --- a/values.yaml +++ b/values.yaml @@ -34,6 +34,7 @@ ## @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 ## @param existingSecret Secret that contains the token ## @param existingSecretKey Secret key ## @param giteaRootURL URL the act_runner registers and connect with @@ -49,6 +50,7 @@ statefulset: affinity: {} extraVolumes: [] securityContext: {} + serviceAccountName: "" actRunner: registry: "docker.gitea.com"