mirror of
https://gitea.com/gitea/helm-actions.git
synced 2026-12-01 17:07:50 +00:00
Compare commits
2
Commits
v0.1.4
...
20d77cb7ec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20d77cb7ec | ||
|
|
5039cb180b |
@@ -8,7 +8,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
changelog:
|
changelog:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: docker.io/thegeeklab/git-sv:3.0.6
|
container: docker.io/thegeeklab/git-sv:3.0.7
|
||||||
steps:
|
steps:
|
||||||
- name: install tools
|
- name: install tools
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=docker depName=alpine/helm
|
# renovate: datasource=docker depName=alpine/helm
|
||||||
HELM_VERSION: "4.3.1"
|
HELM_VERSION: "4.3.2"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
generate-chart-publish:
|
generate-chart-publish:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
check-and-test:
|
check-and-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: alpine/helm:4.3.1
|
container: alpine/helm:4.3.2
|
||||||
steps:
|
steps:
|
||||||
- name: install tools
|
- name: install tools
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ stringData:
|
|||||||
runner-token: "my-cool-runner-token-given-by-gitea"
|
runner-token: "my-cool-runner-token-given-by-gitea"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Native Kubernetes jobs
|
||||||
|
|
||||||
|
The default backend uses Docker-in-Docker. To run each job as a Kubernetes pod, see the [Kubernetes configuration guide](./docs/kubernetes.md).
|
||||||
|
|
||||||
### Rootless Options
|
### Rootless Options
|
||||||
|
|
||||||
If `.Values.statefulset.dind.rootless: true` is set, then the following will be required:
|
If `.Values.statefulset.dind.rootless: true` is set, then the following will be required:
|
||||||
@@ -70,6 +74,8 @@ For resource limit examples (runner vs DinD), see [docs/resources.md](./docs/res
|
|||||||
| Name | Description | Value |
|
| Name | Description | Value |
|
||||||
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------ |
|
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------ |
|
||||||
| `enabled` | Create a Gitea Runner StatefulSet. | `false` |
|
| `enabled` | Create a Gitea Runner StatefulSet. | `false` |
|
||||||
|
| `serviceAccount.create` | Create a service account for the runner. Uses statefulset.serviceAccountName or a generated name. | `false` |
|
||||||
|
| `rbac.create` | Create namespace-scoped permissions for Kubernetes job pods. Requires a created or explicitly named service account. | `false` |
|
||||||
| `statefulset.replicas` | the amount of (replica) runner pods deployed | `1` |
|
| `statefulset.replicas` | the amount of (replica) runner pods deployed | `1` |
|
||||||
| `statefulset.timezone` | is the timezone that will be set in the runner image | `Etc/UTC` |
|
| `statefulset.timezone` | is the timezone that will be set in the runner image | `Etc/UTC` |
|
||||||
| `statefulset.annotations` | Gitea Runner annotations | `{}` |
|
| `statefulset.annotations` | Gitea Runner annotations | `{}` |
|
||||||
@@ -81,7 +87,7 @@ For resource limit examples (runner vs DinD), see [docs/resources.md](./docs/res
|
|||||||
| `statefulset.extraVolumes` | Extra volumes for the statefulset | `[]` |
|
| `statefulset.extraVolumes` | Extra volumes for the statefulset | `[]` |
|
||||||
| `statefulset.persistence.size` | Size for persistence to store Gitea Runner data | `1Gi` |
|
| `statefulset.persistence.size` | Size for persistence to store Gitea Runner data | `1Gi` |
|
||||||
| `statefulset.securityContext` | Customize the SecurityContext | `{}` |
|
| `statefulset.securityContext` | Customize the SecurityContext | `{}` |
|
||||||
| `statefulset.serviceAccountName` | Customize the service account name | `""` |
|
| `statefulset.serviceAccountName` | Name of the runner service account. When serviceAccount.create is false, the account must already exist. | `""` |
|
||||||
| `statefulset.runtimeClassName` | Select a different RuntimeClass for pods | `""` |
|
| `statefulset.runtimeClassName` | Select a different RuntimeClass for pods | `""` |
|
||||||
| `statefulset.hostAliases` | Inject entries into the /etc/hosts file | `[]` |
|
| `statefulset.hostAliases` | Inject entries into the /etc/hosts file | `[]` |
|
||||||
| `statefulset.persistence.size` | Size for persistence to store Gitea Runner data | `1Gi` |
|
| `statefulset.persistence.size` | Size for persistence to store Gitea Runner data | `1Gi` |
|
||||||
@@ -96,6 +102,7 @@ For resource limit examples (runner vs DinD), see [docs/resources.md](./docs/res
|
|||||||
| `statefulset.runner.extraEnvs` | Allows adding custom environment variables | `[]` |
|
| `statefulset.runner.extraEnvs` | Allows adding custom environment variables | `[]` |
|
||||||
| `statefulset.runner.flushCache` | whether to clear the .runner (cache) file by creating an extra init container, can slightly increase boot-up time | `false` |
|
| `statefulset.runner.flushCache` | whether to clear the .runner (cache) file by creating an extra init container, can slightly increase boot-up time | `false` |
|
||||||
| `statefulset.runner.config` | Gitea Runner custom configuration. See [Gitea Runner documentation](https://docs.gitea.com/usage/actions/act-runner#configuration) for details. | `Too complex. See values.yaml` |
|
| `statefulset.runner.config` | Gitea Runner custom configuration. See [Gitea Runner documentation](https://docs.gitea.com/usage/actions/act-runner#configuration) for details. | `Too complex. See values.yaml` |
|
||||||
|
| `statefulset.dind.enabled` | Deploy the Docker-in-Docker sidecar and mount its socket in the runner. Disable for Kubernetes-only runners. | `true` |
|
||||||
| `statefulset.dind.rootless` | a simple flag to let helm know we are dealing with a rootless dind container | `false` |
|
| `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.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.dind.registry` | image registry, e.g. gcr.io,docker.io | `docker.io` |
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Gitea Actions Helm Chart Docs
|
# Gitea Actions Helm Chart Docs
|
||||||
|
|
||||||
|
- [Native Kubernetes jobs](./kubernetes.md)
|
||||||
- [Resource limits and capacity](./resources.md)
|
- [Resource limits and capacity](./resources.md)
|
||||||
- [connectionCommandOverride explanation](./connectionCommandOverride.md)
|
- [connectionCommandOverride explanation](./connectionCommandOverride.md)
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
# Native Kubernetes jobs
|
||||||
|
|
||||||
|
Gitea Runner 4.1.0 or later can create a Kubernetes pod for each job. This requires Kubernetes 1.30 or later and does not require a Docker daemon or privileged runner container.
|
||||||
|
|
||||||
|
Create a registration token Secret in the runner namespace, as described in the [quick-start](../README.md#runner-token-secret-template), then use these values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
enabled: true
|
||||||
|
giteaRootURL: https://gitea.example.com
|
||||||
|
existingSecret: runner-secret
|
||||||
|
existingSecretKey: runner-token
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
create: true
|
||||||
|
rbac:
|
||||||
|
create: true
|
||||||
|
|
||||||
|
statefulset:
|
||||||
|
replicas: 1
|
||||||
|
dind:
|
||||||
|
enabled: false
|
||||||
|
runner:
|
||||||
|
config: |
|
||||||
|
log:
|
||||||
|
level: info
|
||||||
|
runner:
|
||||||
|
capacity: 6
|
||||||
|
labels:
|
||||||
|
- ubuntu-latest:kubernetes://docker.gitea.com/runner-images:ubuntu-latest
|
||||||
|
cache:
|
||||||
|
enabled: false
|
||||||
|
kubernetes:
|
||||||
|
pod_template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: job
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
```
|
||||||
|
|
||||||
|
Save this as `kubernetes-values.yaml` and install:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
helm upgrade --install gitea-actions gitea-charts/actions \
|
||||||
|
--namespace gitea-actions --create-namespace \
|
||||||
|
-f kubernetes-values.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Workflows select the backend with `runs-on: ubuntu-latest`. One runner manager can start up to six concurrent job pods with these values; the cluster still needs enough resources to schedule them.
|
||||||
|
`statefulset.replicas` controls the number of persistent managers, while `runner.capacity` limits concurrent jobs per manager. This does not autoscale managers or cluster nodes.
|
||||||
|
|
||||||
|
Replace the runner configuration as shown, including its labels, when disabling DinD. The chart's default configuration requires Docker.
|
||||||
|
The manager keeps its registration in the existing data volume. The runner creates job pods on demand and removes them and their temporary Secrets after execution.
|
||||||
|
Job pods do not mount a service account token by default.
|
||||||
|
|
||||||
|
## Service accounts and permissions
|
||||||
|
|
||||||
|
`serviceAccount.create` creates the manager's service account. Set `statefulset.serviceAccountName` to choose its name; otherwise the chart generates one.
|
||||||
|
To use an existing account, set `serviceAccount.create: false` and supply its name through `statefulset.serviceAccountName`.
|
||||||
|
|
||||||
|
`rbac.create` independently creates a Role and RoleBinding in the runner namespace, with these permissions:
|
||||||
|
|
||||||
|
| Resource | Verbs |
|
||||||
|
| --- | --- |
|
||||||
|
| `pods` | `create`, `get`, `list`, `delete` |
|
||||||
|
| `pods/exec` | `create`, `get` |
|
||||||
|
| `pods/log` | `get` |
|
||||||
|
| `secrets` | `create`, `delete` |
|
||||||
|
|
||||||
|
Use a dedicated namespace for jobs whose workflows you trust with these permissions. The Role covers all pods and Secrets in that namespace.
|
||||||
|
If permissions are managed externally, leave `rbac.create: false` and bind the required permissions to the runner's service account yourself.
|
||||||
|
If `kubernetes.namespace` targets a different namespace, configure the Role and binding there yourself; chart-managed RBAC only covers the runner namespace.
|
||||||
|
|
||||||
|
## Job configuration and compatibility
|
||||||
|
|
||||||
|
Configure job resources, scheduling and private image pull Secrets through `kubernetes.pod_template` in the runner configuration.
|
||||||
|
`statefulset.runner.resources`, scheduling options and `global.imagePullSecrets` apply to the manager, not the dynamically created job pods.
|
||||||
|
JavaScript actions need Node.js in the job image, and checkout needs Git. Services run alongside the job container in the same pod.
|
||||||
|
|
||||||
|
Docker actions, `docker://` steps and some Docker-specific container options are unsupported by this backend.
|
||||||
|
See the [runner's Kubernetes documentation](https://gitea.com/gitea/runner/src/branch/main/docs/kubernetes.md) for configuration and compatibility details.
|
||||||
|
|
||||||
|
For mixed workloads, keep `statefulset.dind.enabled: true`, enable the service account permissions, and configure distinct `docker://` and `kubernetes://` labels in the runner configuration.
|
||||||
|
Workflows select the appropriate label with `runs-on`; no chart-wide backend switch is needed.
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
{{- if or (empty .Values.existingSecret) (empty .Values.existingSecretKey) -}}
|
{{- if or (empty .Values.existingSecret) (empty .Values.existingSecretKey) -}}
|
||||||
{{- fail "existingSecret and existingSecretKey are required when provisioning is disabled" -}}
|
{{- fail "existingSecret and existingSecretKey are required when provisioning is disabled" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- if and (.Values.rbac | default dict).create (not (.Values.serviceAccount | default dict).create) (empty .Values.statefulset.serviceAccountName) -}}
|
||||||
|
{{- fail "rbac.create requires serviceAccount.create or statefulset.serviceAccountName" -}}
|
||||||
|
{{- end -}}
|
||||||
{{- if not .Values.giteaRootURL -}}
|
{{- if not .Values.giteaRootURL -}}
|
||||||
{{- fail "giteaRootURL is required" -}}
|
{{- fail "giteaRootURL is required" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@@ -143,3 +143,11 @@ Create image for Init
|
|||||||
{{- define "gitea.actions.init.image" -}}
|
{{- define "gitea.actions.init.image" -}}
|
||||||
{{ include "gitea.actions.common.image" (dict "root" . "image" .Values.init.image) }}
|
{{ include "gitea.actions.common.image" (dict "root" . "image" .Values.init.image) }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "gitea.actions.serviceAccountName" -}}
|
||||||
|
{{- if (.Values.serviceAccount | default dict).create -}}
|
||||||
|
{{- default (printf "%s-runner" (include "gitea.actions.fullname" .) | trunc 63 | trimSuffix "-") .Values.statefulset.serviceAccountName -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .Values.statefulset.serviceAccountName -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{{- if and .Values.enabled (.Values.rbac | default dict).create }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: {{ include "gitea.actions.fullname" . }}-runner
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
labels:
|
||||||
|
{{- include "gitea.actions.labels.runner" . | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["pods"]
|
||||||
|
verbs: ["create", "get", "list", "delete"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["pods/exec"]
|
||||||
|
verbs: ["create", "get"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["pods/log"]
|
||||||
|
verbs: ["get"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["secrets"]
|
||||||
|
verbs: ["create", "delete"]
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ include "gitea.actions.fullname" . }}-runner
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
labels:
|
||||||
|
{{- include "gitea.actions.labels.runner" . | nindent 4 }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: {{ include "gitea.actions.fullname" . }}-runner
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ include "gitea.actions.serviceAccountName" . | quote }}
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{{- if and .Values.enabled (.Values.serviceAccount | default dict).create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ include "gitea.actions.serviceAccountName" . | quote }}
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
labels:
|
||||||
|
{{- include "gitea.actions.labels.runner" . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
@@ -31,8 +31,8 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
{{- if .Values.statefulset.serviceAccountName }}
|
{{- if or (.Values.serviceAccount | default dict).create .Values.statefulset.serviceAccountName }}
|
||||||
serviceAccountName: {{ .Values.statefulset.serviceAccountName | quote }}
|
serviceAccountName: {{ include "gitea.actions.serviceAccountName" . | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.statefulset.securityContext }}
|
{{- if .Values.statefulset.securityContext }}
|
||||||
securityContext:
|
securityContext:
|
||||||
@@ -85,6 +85,7 @@ spec:
|
|||||||
echo "Trying again in 3 seconds..."
|
echo "Trying again in 3 seconds..."
|
||||||
done
|
done
|
||||||
echo "Gitea has been reached!"
|
echo "Gitea has been reached!"
|
||||||
|
{{- if ne .Values.statefulset.dind.enabled false }}
|
||||||
- name: dind
|
- name: dind
|
||||||
image: "{{ include "gitea.actions.dind.image" . }}"
|
image: "{{ include "gitea.actions.dind.image" . }}"
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
@@ -131,6 +132,7 @@ spec:
|
|||||||
{{- with .Values.statefulset.dind.extraVolumeMounts }}
|
{{- with .Values.statefulset.dind.extraVolumeMounts }}
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- if .Values.postExtraInitContainers }}
|
{{- if .Values.postExtraInitContainers }}
|
||||||
{{- toYaml .Values.postExtraInitContainers | nindent 8 }}
|
{{- toYaml .Values.postExtraInitContainers | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -160,9 +162,11 @@ spec:
|
|||||||
- mountPath: /runner/config.yaml
|
- mountPath: /runner/config.yaml
|
||||||
name: runner-config
|
name: runner-config
|
||||||
subPath: config.yaml
|
subPath: config.yaml
|
||||||
|
{{- if ne .Values.statefulset.dind.enabled false }}
|
||||||
- mountPath: /var/run/docker.sock
|
- mountPath: /var/run/docker.sock
|
||||||
name: docker-socket
|
name: docker-socket
|
||||||
subPath: docker.sock
|
subPath: docker.sock
|
||||||
|
{{- end }}
|
||||||
- mountPath: /data
|
- mountPath: /data
|
||||||
name: data-runner
|
name: data-runner
|
||||||
{{- with .Values.statefulset.runner.extraVolumeMounts }}
|
{{- with .Values.statefulset.runner.extraVolumeMounts }}
|
||||||
@@ -190,8 +194,10 @@ spec:
|
|||||||
- name: runner-config
|
- name: runner-config
|
||||||
configMap:
|
configMap:
|
||||||
name: {{ include "gitea.actions.fullname" . }}-runner-configmap
|
name: {{ include "gitea.actions.fullname" . }}-runner-configmap
|
||||||
|
{{- if ne .Values.statefulset.dind.enabled false }}
|
||||||
- name: docker-socket
|
- name: docker-socket
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
{{- with .Values.statefulset.extraVolumes }}
|
{{- with .Values.statefulset.extraVolumes }}
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -33,3 +33,25 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- failedTemplate:
|
- failedTemplate:
|
||||||
errorMessage: "giteaRootURL is required"
|
errorMessage: "giteaRootURL is required"
|
||||||
|
- it: requires an explicit service account when granting Kubernetes permissions
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
serviceAccount: null
|
||||||
|
existingSecret: my-secret
|
||||||
|
existingSecretKey: token
|
||||||
|
giteaRootURL: https://gitea.example.com
|
||||||
|
rbac.create: true
|
||||||
|
asserts:
|
||||||
|
- failedTemplate:
|
||||||
|
errorMessage: "rbac.create requires serviceAccount.create or statefulset.serviceAccountName"
|
||||||
|
- it: accepts reused legacy values without the new creation maps
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
existingSecret: my-secret
|
||||||
|
existingSecretKey: token
|
||||||
|
giteaRootURL: https://gitea.example.com
|
||||||
|
serviceAccount: null
|
||||||
|
rbac: null
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
|||||||
@@ -0,0 +1,423 @@
|
|||||||
|
suite: actions template | native Kubernetes
|
||||||
|
release:
|
||||||
|
name: native-test
|
||||||
|
namespace: runners
|
||||||
|
templates:
|
||||||
|
- templates/statefulset.yaml
|
||||||
|
- templates/configmap.yaml
|
||||||
|
- templates/serviceaccount.yaml
|
||||||
|
- templates/rbac.yaml
|
||||||
|
tests:
|
||||||
|
- it: creates no serviceaccount.yaml by default
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
template: serviceaccount.yaml
|
||||||
|
- it: creates no serviceaccount.yaml when the chart is disabled
|
||||||
|
set:
|
||||||
|
serviceAccount.create: true
|
||||||
|
rbac.create: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
template: serviceaccount.yaml
|
||||||
|
- it: creates no rbac.yaml by default
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
template: rbac.yaml
|
||||||
|
- it: creates no rbac.yaml when the chart is disabled
|
||||||
|
set:
|
||||||
|
serviceAccount.create: true
|
||||||
|
rbac.create: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
template: rbac.yaml
|
||||||
|
- it: removes DinD and its socket while retaining runner data and configuration
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
statefulset.dind.rootless: true
|
||||||
|
statefulset.dind.uid: 1001
|
||||||
|
statefulset.dind.enabled: false
|
||||||
|
serviceAccount.create: true
|
||||||
|
rbac.create: true
|
||||||
|
asserts:
|
||||||
|
- lengthEqual:
|
||||||
|
path: spec.template.spec.initContainers
|
||||||
|
count: 1
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[0].name
|
||||||
|
value: reach-gitea
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.volumes
|
||||||
|
value:
|
||||||
|
- name: runner-config
|
||||||
|
configMap:
|
||||||
|
name: native-test-runner-configmap
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts
|
||||||
|
value:
|
||||||
|
- mountPath: /runner/config.yaml
|
||||||
|
name: runner-config
|
||||||
|
subPath: config.yaml
|
||||||
|
- mountPath: /data
|
||||||
|
name: data-runner
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.serviceAccountName
|
||||||
|
value: native-test-runner
|
||||||
|
template: statefulset.yaml
|
||||||
|
- it: preserves extra init containers and volumes without DinD
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
statefulset.dind.enabled: false
|
||||||
|
serviceAccount.create: true
|
||||||
|
rbac.create: true
|
||||||
|
preExtraInitContainers:
|
||||||
|
- name: before
|
||||||
|
image: busybox
|
||||||
|
postExtraInitContainers:
|
||||||
|
- name: after
|
||||||
|
image: busybox
|
||||||
|
statefulset.extraVolumes:
|
||||||
|
- name: extra
|
||||||
|
emptyDir: {}
|
||||||
|
statefulset.runner.extraVolumeMounts:
|
||||||
|
- name: extra
|
||||||
|
mountPath: /extra
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[0].name
|
||||||
|
value: before
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].name
|
||||||
|
value: reach-gitea
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[2].name
|
||||||
|
value: after
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.volumes[1].name
|
||||||
|
value: extra
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts[2].name
|
||||||
|
value: extra
|
||||||
|
template: statefulset.yaml
|
||||||
|
- it: creates a service account in runners
|
||||||
|
set: &native
|
||||||
|
enabled: true
|
||||||
|
statefulset.dind.enabled: false
|
||||||
|
serviceAccount.create: true
|
||||||
|
rbac.create: true
|
||||||
|
asserts:
|
||||||
|
- isKind:
|
||||||
|
of: ServiceAccount
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: native-test-runner
|
||||||
|
- equal:
|
||||||
|
path: metadata.namespace
|
||||||
|
value: runners
|
||||||
|
template: serviceaccount.yaml
|
||||||
|
- it: creates only the required job permissions in runners
|
||||||
|
set: *native
|
||||||
|
asserts:
|
||||||
|
- isKind:
|
||||||
|
of: Role
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: native-test-runner
|
||||||
|
- equal:
|
||||||
|
path: metadata.namespace
|
||||||
|
value: runners
|
||||||
|
- equal:
|
||||||
|
path: rules
|
||||||
|
value:
|
||||||
|
- apiGroups:
|
||||||
|
- ''
|
||||||
|
resources:
|
||||||
|
- pods
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- delete
|
||||||
|
- apiGroups:
|
||||||
|
- ''
|
||||||
|
resources:
|
||||||
|
- pods/exec
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- get
|
||||||
|
- apiGroups:
|
||||||
|
- ''
|
||||||
|
resources:
|
||||||
|
- pods/log
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- apiGroups:
|
||||||
|
- ''
|
||||||
|
resources:
|
||||||
|
- secrets
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
template: rbac.yaml
|
||||||
|
documentIndex: 0
|
||||||
|
- it: binds permissions to the manager account in runners
|
||||||
|
set: *native
|
||||||
|
asserts:
|
||||||
|
- isKind:
|
||||||
|
of: RoleBinding
|
||||||
|
- equal:
|
||||||
|
path: metadata.namespace
|
||||||
|
value: runners
|
||||||
|
- equal:
|
||||||
|
path: roleRef
|
||||||
|
value:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: native-test-runner
|
||||||
|
- equal:
|
||||||
|
path: subjects
|
||||||
|
value:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: native-test-runner
|
||||||
|
namespace: runners
|
||||||
|
template: rbac.yaml
|
||||||
|
documentIndex: 1
|
||||||
|
- it: creates a service account in custom-namespace
|
||||||
|
set: &customNamespace
|
||||||
|
enabled: true
|
||||||
|
statefulset.dind.enabled: false
|
||||||
|
serviceAccount.create: true
|
||||||
|
rbac.create: true
|
||||||
|
namespace: custom-namespace
|
||||||
|
asserts:
|
||||||
|
- isKind:
|
||||||
|
of: ServiceAccount
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: native-test-runner
|
||||||
|
- equal:
|
||||||
|
path: metadata.namespace
|
||||||
|
value: custom-namespace
|
||||||
|
template: serviceaccount.yaml
|
||||||
|
- it: creates only the required job permissions in custom-namespace
|
||||||
|
set: *customNamespace
|
||||||
|
asserts:
|
||||||
|
- isKind:
|
||||||
|
of: Role
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: native-test-runner
|
||||||
|
- equal:
|
||||||
|
path: metadata.namespace
|
||||||
|
value: custom-namespace
|
||||||
|
- equal:
|
||||||
|
path: rules
|
||||||
|
value:
|
||||||
|
- apiGroups:
|
||||||
|
- ''
|
||||||
|
resources:
|
||||||
|
- pods
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- delete
|
||||||
|
- apiGroups:
|
||||||
|
- ''
|
||||||
|
resources:
|
||||||
|
- pods/exec
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- get
|
||||||
|
- apiGroups:
|
||||||
|
- ''
|
||||||
|
resources:
|
||||||
|
- pods/log
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- apiGroups:
|
||||||
|
- ''
|
||||||
|
resources:
|
||||||
|
- secrets
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
template: rbac.yaml
|
||||||
|
documentIndex: 0
|
||||||
|
- it: binds permissions to the manager account in custom-namespace
|
||||||
|
set: *customNamespace
|
||||||
|
asserts:
|
||||||
|
- isKind:
|
||||||
|
of: RoleBinding
|
||||||
|
- equal:
|
||||||
|
path: metadata.namespace
|
||||||
|
value: custom-namespace
|
||||||
|
- equal:
|
||||||
|
path: roleRef
|
||||||
|
value:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: native-test-runner
|
||||||
|
- equal:
|
||||||
|
path: subjects
|
||||||
|
value:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: native-test-runner
|
||||||
|
namespace: custom-namespace
|
||||||
|
template: rbac.yaml
|
||||||
|
documentIndex: 1
|
||||||
|
- it: uses the chosen account when create is true
|
||||||
|
set: &createdAccount
|
||||||
|
enabled: true
|
||||||
|
statefulset.dind.enabled: false
|
||||||
|
serviceAccount.create: true
|
||||||
|
rbac.create: true
|
||||||
|
statefulset.serviceAccountName: chosen-account
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.serviceAccountName
|
||||||
|
value: chosen-account
|
||||||
|
template: statefulset.yaml
|
||||||
|
- it: binds the chosen account when create is true
|
||||||
|
set: *createdAccount
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: subjects[0].name
|
||||||
|
value: chosen-account
|
||||||
|
template: rbac.yaml
|
||||||
|
documentIndex: 1
|
||||||
|
- it: handles the chosen account when create is true
|
||||||
|
set: *createdAccount
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: chosen-account
|
||||||
|
template: serviceaccount.yaml
|
||||||
|
- it: uses the chosen account when create is false
|
||||||
|
set: &existingAccount
|
||||||
|
enabled: true
|
||||||
|
statefulset.dind.enabled: false
|
||||||
|
serviceAccount.create: false
|
||||||
|
rbac.create: true
|
||||||
|
statefulset.serviceAccountName: chosen-account
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.serviceAccountName
|
||||||
|
value: chosen-account
|
||||||
|
template: statefulset.yaml
|
||||||
|
- it: binds the chosen account when create is false
|
||||||
|
set: *existingAccount
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: subjects[0].name
|
||||||
|
value: chosen-account
|
||||||
|
template: rbac.yaml
|
||||||
|
documentIndex: 1
|
||||||
|
- it: handles the chosen account when create is false
|
||||||
|
set: *existingAccount
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
template: serviceaccount.yaml
|
||||||
|
- it: supports externally managed permissions
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
statefulset.dind.enabled: false
|
||||||
|
serviceAccount.create: true
|
||||||
|
rbac.create: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
template: rbac.yaml
|
||||||
|
- it: keeps DinD available with Kubernetes permissions for mixed labels
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
statefulset.dind.enabled: true
|
||||||
|
serviceAccount.create: true
|
||||||
|
rbac.create: true
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].name
|
||||||
|
value: dind
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts[1].name
|
||||||
|
value: docker-socket
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.serviceAccountName
|
||||||
|
value: native-test-runner
|
||||||
|
template: statefulset.yaml
|
||||||
|
- it: preserves Docker defaults when an upgrade reuses values without the new options
|
||||||
|
template: statefulset.yaml
|
||||||
|
set: &legacyValues
|
||||||
|
enabled: true
|
||||||
|
serviceAccount: null
|
||||||
|
rbac: null
|
||||||
|
statefulset.dind.enabled: null
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].name
|
||||||
|
value: dind
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.volumes[1].name
|
||||||
|
value: docker-socket
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts[1].name
|
||||||
|
value: docker-socket
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.serviceAccountName
|
||||||
|
- it: creates no service account when reusing legacy values
|
||||||
|
template: serviceaccount.yaml
|
||||||
|
set: *legacyValues
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
- it: creates no RBAC when reusing legacy values
|
||||||
|
template: rbac.yaml
|
||||||
|
set: *legacyValues
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
- it: preserves a boolean-looking service account name as a string
|
||||||
|
template: serviceaccount.yaml
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
serviceAccount.create: true
|
||||||
|
statefulset.serviceAccountName: "true"
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: "true"
|
||||||
|
- it: preserves a numeric existing service account name as a string in its binding
|
||||||
|
template: rbac.yaml
|
||||||
|
documentIndex: 1
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
rbac.create: true
|
||||||
|
statefulset.serviceAccountName: "123"
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: subjects[0].name
|
||||||
|
value: "123"
|
||||||
|
- it: retains rootless Docker socket paths when DinD is enabled
|
||||||
|
template: statefulset.yaml
|
||||||
|
set:
|
||||||
|
enabled: true
|
||||||
|
statefulset.dind.rootless: true
|
||||||
|
statefulset.dind.uid: 1001
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].volumeMounts[0].mountPath
|
||||||
|
value: /run/user/1001/
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].startupProbe.exec.command[2]
|
||||||
|
value: /run/user/1001/docker.sock
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts[1].mountPath
|
||||||
|
value: /var/run/docker.sock
|
||||||
+9
-1
@@ -5,6 +5,8 @@
|
|||||||
## @descriptionEnd
|
## @descriptionEnd
|
||||||
#
|
#
|
||||||
## @param enabled Create a Gitea Runner StatefulSet.
|
## @param enabled Create a Gitea Runner StatefulSet.
|
||||||
|
## @param serviceAccount.create Create a service account for the runner. Uses statefulset.serviceAccountName or a generated name.
|
||||||
|
## @param rbac.create Create namespace-scoped permissions for Kubernetes job pods. Requires a created or explicitly named service account.
|
||||||
## @param statefulset.replicas the amount of (replica) runner pods deployed
|
## @param statefulset.replicas the amount of (replica) runner pods deployed
|
||||||
## @param statefulset.timezone is the timezone that will be set in the runner image
|
## @param statefulset.timezone is the timezone that will be set in the runner image
|
||||||
## @param statefulset.annotations Gitea Runner annotations
|
## @param statefulset.annotations Gitea Runner annotations
|
||||||
@@ -16,7 +18,7 @@
|
|||||||
## @param statefulset.extraVolumes Extra volumes for the statefulset
|
## @param statefulset.extraVolumes Extra volumes for the statefulset
|
||||||
## @param statefulset.persistence.size Size for persistence to store Gitea Runner data
|
## @param statefulset.persistence.size Size for persistence to store Gitea Runner data
|
||||||
## @param statefulset.securityContext Customize the SecurityContext
|
## @param statefulset.securityContext Customize the SecurityContext
|
||||||
## @param statefulset.serviceAccountName Customize the service account name
|
## @param statefulset.serviceAccountName Name of the runner service account. When serviceAccount.create is false, the account must already exist.
|
||||||
## @param statefulset.runtimeClassName Select a different RuntimeClass for pods
|
## @param statefulset.runtimeClassName Select a different RuntimeClass for pods
|
||||||
## @param statefulset.hostAliases Inject entries into the /etc/hosts file
|
## @param statefulset.hostAliases Inject entries into the /etc/hosts file
|
||||||
#
|
#
|
||||||
@@ -34,6 +36,7 @@
|
|||||||
## @param statefulset.runner.flushCache whether to clear the .runner (cache) file by creating an extra init container, can slightly increase boot-up time
|
## @param statefulset.runner.flushCache whether to clear the .runner (cache) file by creating an extra init container, can slightly increase boot-up time
|
||||||
## @param statefulset.runner.config [default: Too complex. See values.yaml] Gitea Runner custom configuration. See [Gitea Runner documentation](https://docs.gitea.com/usage/actions/act-runner#configuration) for details.
|
## @param statefulset.runner.config [default: Too complex. See values.yaml] Gitea Runner custom configuration. See [Gitea Runner documentation](https://docs.gitea.com/usage/actions/act-runner#configuration) for details.
|
||||||
#
|
#
|
||||||
|
## @param statefulset.dind.enabled Deploy the Docker-in-Docker sidecar and mount its socket in the runner. Disable for Kubernetes-only runners.
|
||||||
## @param statefulset.dind.rootless [default: false] a simple flag to let helm know we are dealing with a rootless dind container
|
## @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.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.dind.registry image registry, e.g. gcr.io,docker.io
|
||||||
@@ -48,6 +51,10 @@
|
|||||||
## @param statefulset.dind.extraArgs Allows adding custom arguments to the Docker Daemon
|
## @param statefulset.dind.extraArgs Allows adding custom arguments to the Docker Daemon
|
||||||
#
|
#
|
||||||
enabled: false
|
enabled: false
|
||||||
|
serviceAccount:
|
||||||
|
create: false
|
||||||
|
rbac:
|
||||||
|
create: false
|
||||||
statefulset:
|
statefulset:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
timezone: Etc/UTC
|
timezone: Etc/UTC
|
||||||
@@ -102,6 +109,7 @@ statefulset:
|
|||||||
docker_timeout: 300s
|
docker_timeout: 300s
|
||||||
|
|
||||||
dind:
|
dind:
|
||||||
|
enabled: true
|
||||||
rootless: false
|
rootless: false
|
||||||
uid: ""
|
uid: ""
|
||||||
registry: "docker.io"
|
registry: "docker.io"
|
||||||
|
|||||||
Reference in New Issue
Block a user