Use a config map to configure the runner

This commit is contained in:
Stefan Bethke 2024-09-04 08:47:14 +02:00
parent d440b1ca7a
commit 33ea14dd84
4 changed files with 37 additions and 4 deletions

View file

@ -1090,8 +1090,24 @@ The chart can deploy an [Actions Runner](https://forgejo.org/docs/latest/admin/a
The available runner tags are listed here: <https://code.forgejo.org/forgejo/-/packages/container/runner/versions> The available runner tags are listed here: <https://code.forgejo.org/forgejo/-/packages/container/runner/versions>
The **Runner Configuration** `gitea.actions.runner.config` is simply the contents of the
[runner config file](https://forgejo.codeberg.page/docs/v1.20/admin/actions/#configuration).
Make sure to specify at least one label so that workflows can find the runner.
Default runner config:
```yaml
gitea:
actions:
config:
runner:
labels:
- docker:docker://node:16-bullseye
```
| Name | Description | Value | | Name | Description | Value |
|-----------------------------------------------|------------------------------------------------------------|--------------------| |-----------------------------------------------|------------------------------------------------------------|--------------------|
| `gitea.actions.runner.config` | Runner configuration map. | |
| `gitea.actions.runner.enabled` | Enable automatic deployment of a runner. | `false` | | `gitea.actions.runner.enabled` | Enable automatic deployment of a runner. | `false` |
| `gitea.actions.runner.image.pullPolicy` | Overrides the pull policy set globally for actions runners | | | `gitea.actions.runner.image.pullPolicy` | Overrides the pull policy set globally for actions runners | |
| `gitea.actions.runner.image.registry` | Image registry, e.g. gcr.io,docker.io | `code.forgejo.org` | | `gitea.actions.runner.image.registry` | Image registry, e.g. gcr.io,docker.io | `code.forgejo.org` |
@ -1099,7 +1115,6 @@ The available runner tags are listed here: <https://code.forgejo.org/forgejo/-/p
| `gitea.actions.runner.image.tag` | Tag to deploy | | | `gitea.actions.runner.image.tag` | Tag to deploy | |
| `gitea.actions.runner.registrationSecretName` | Name of secret containing the registration secret | ~ | | `gitea.actions.runner.registrationSecretName` | Name of secret containing the registration secret | ~ |
| `gitea.actions.runner.replicas` | Number of replicas to automatically deploy | 1 | | `gitea.actions.runner.replicas` | Number of replicas to automatically deploy | 1 |
| `gitea.actions.runner.runnerLabels` | Forgejo Runner labels to assign to the runner | `["docker"]` |
#### Registration Secret #### Registration Secret

View file

@ -0,0 +1,9 @@
{{- if .Values.gitea.actions.runner.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "gitea.fullname" . }}-runner
data:
config.yaml: |
{{ toYaml .Values.gitea.actions.runner.config | indent 4 }}
{{- end }}

View file

@ -37,8 +37,6 @@ spec:
- "/runner-secret/runner-registration-secret" - "/runner-secret/runner-registration-secret"
- "--instance" - "--instance"
- "http://{{ .Release.Name }}-http:{{ .Values.service.http.port }}" - "http://{{ .Release.Name }}-http:{{ .Values.service.http.port }}"
- "--labels"
- "{{ join "," .Values.gitea.actions.runner.runnerLabels }}"
volumeMounts: volumeMounts:
- name: data - name: data
mountPath: /data mountPath: /data
@ -60,9 +58,14 @@ spec:
command: [ "forgejo-runner" ] command: [ "forgejo-runner" ]
args: args:
- daemon - daemon
- "--config"
- /config.yaml
volumeMounts: volumeMounts:
- name: certs - name: certs
mountPath: /certs mountPath: /certs
- name: config
mountPath: /config.yaml
subPath: config.yaml
- name: data - name: data
mountPath: /data mountPath: /data
- name: temp - name: temp
@ -82,6 +85,9 @@ spec:
volumes: volumes:
- name: certs - name: certs
emptyDir: {} emptyDir: {}
- name: config
configMap:
name: {{ include "gitea.fullname" . }}-runner
- name: data - name: data
emptyDir: {} emptyDir: {}
- name: temp - name: temp

View file

@ -366,6 +366,10 @@ gitea:
actions: actions:
runner: runner:
enabled: false enabled: false
config:
runner:
labels:
- docker:docker://node:16-bullseye
image: image:
registry: "code.forgejo.org" registry: "code.forgejo.org"
repository: forgejo/runner repository: forgejo/runner
@ -373,7 +377,6 @@ gitea:
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
registrationSecretName: ~ registrationSecretName: ~
replicas: 1 replicas: 1
runnerLabels: ["docker"]
## @param gitea.metrics.enabled Enable Forgejo metrics ## @param gitea.metrics.enabled Enable Forgejo metrics
## @param gitea.metrics.serviceMonitor.enabled Enable Forgejo metrics service monitor ## @param gitea.metrics.serviceMonitor.enabled Enable Forgejo metrics service monitor