From 7004fb82713cc4a4a3eede87489b8966862e9d75 Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Wed, 11 Sep 2024 13:37:54 +0200 Subject: [PATCH] Rename value to forgejo.runner --- README.md | 20 ++++++------- templates/_helpers.tpl | 16 +++++----- templates/gitea/runner-config.yaml | 4 +-- templates/gitea/runner-secret.yaml | 2 +- templates/gitea/runner.yaml | 14 ++++----- values.yaml | 47 +++++++++++++++--------------- 6 files changed, 52 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index e1aed58..06d5c90 100644 --- a/README.md +++ b/README.md @@ -1122,14 +1122,14 @@ blocks, while the keys themselves remain in all caps. The chart can deploy an [Actions Runner](https://forgejo.org/docs/latest/admin/actions/#forgejo-runner). -The **Runner Configuration** `forgejo_runner.config` is simply the contents of the +The **Runner Configuration** `forgejo.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 -forgejo_runner: +forgejo.runner: __config: ____runner: ______labels: @@ -1138,14 +1138,14 @@ ________- docker:docker://node:16-bullseye | Name | Description | Value | | --------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------ | -| `forgejo_runner.config` | contents of runner's config.yaml | `{}` | -| `forgejo_runner.enabled` | Enable automatic deployment of a runner | `false` | -| `forgejo_runner.image.registry` | Image registry, e.g. gcr.io,docker.io | `code.forgejo.org` | -| `forgejo_runner.image.repository` | Image to start for this pod | `forgejo/runner` | -| `forgejo_runner.image.tag` | Visit: [Image tag](https://code.forgejo.org/forgejo/-/packages/container/runner/versions). | `3.5.1` | -| `forgejo_runner.image.pullPolicy` | Overrides the pull policy set globally for actions runners | `IfNotPresent` | -| `forgejo_runner.registrationSecretName` | Name of secret containing the registration secret. If unset, the chart will create one | `nil` | -| `forgejo_runner.replicas` | Number of replicas to automatically deploy | `1` | +| `forgejo.runner.config` | contents of runner's config.yaml | `{}` | +| `forgejo.runner.enabled` | Enable automatic deployment of a runner | `false` | +| `forgejo.runner.image.registry` | Image registry, e.g. gcr.io,docker.io | `code.forgejo.org` | +| `forgejo.runner.image.repository` | Image to start for this pod | `forgejo/runner` | +| `forgejo.runner.image.tag` | Visit: [Image tag](https://code.forgejo.org/forgejo/-/packages/container/runner/versions). | `3.5.1` | +| `forgejo.runner.image.pullPolicy` | Overrides the pull policy set globally for actions runners | `IfNotPresent` | +| `forgejo.runner.registrationSecretName` | Name of secret containing the registration secret. If unset, the chart will create one | `nil` | +| `forgejo.runner.replicas` | Number of replicas to automatically deploy | `1` | ### Redis® Cluster diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 5291e91..e6e40f4 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -67,9 +67,9 @@ Create image name and tag used by the deployment. Create image name and tag used by the actions runner. */}} {{- define "gitea.actions-image" -}} -{{- $registry := .Values.forgejo_runner.image.registry | default (.Values.global.imageRegistry | default .Values.image.registry) -}} -{{- $name := .Values.forgejo_runner.image.repository -}} -{{- $tag := .Values.forgejo_runner.image.tag -}} +{{- $registry := .Values.forgejo.runner.image.registry | default (.Values.global.imageRegistry | default .Values.image.registry) -}} +{{- $name := .Values.forgejo.runner.image.repository -}} +{{- $tag := .Values.forgejo.runner.image.tag -}} {{- if $registry -}} {{- printf "%s/%s:%s" $registry $name $tag -}} {{- else -}} @@ -125,19 +125,19 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{/* Actions runner labels */}} -{{- define "forgejo_runner.labels" -}} +{{- define "forgejo.runner.labels" -}} helm.sh/chart: {{ include "gitea.chart" . }} app: actions-runner -{{ include "forgejo_runner.selectorLabels" . }} -app.kubernetes.io/version: {{ .Values.forgejo_runner.image.tag | quote }} -version: {{ .Values.forgejo_runner.image.tag | quote }} +{{ include "forgejo.runner.selectorLabels" . }} +app.kubernetes.io/version: {{ .Values.forgejo.runner.image.tag | quote }} +version: {{ .Values.forgejo.runner.image.tag | quote }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} {{/* Actions runner selector labels */}} -{{- define "forgejo_runner.selectorLabels" -}} +{{- define "forgejo.runner.selectorLabels" -}} app.kubernetes.io/name: actions-runner app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} diff --git a/templates/gitea/runner-config.yaml b/templates/gitea/runner-config.yaml index 1d703ac..3a7fbfc 100644 --- a/templates/gitea/runner-config.yaml +++ b/templates/gitea/runner-config.yaml @@ -1,9 +1,9 @@ -{{- if .Values.forgejo_runner.enabled -}} +{{- if .Values.forgejo.runner.enabled -}} apiVersion: v1 kind: ConfigMap metadata: name: {{ include "gitea.fullname" . }}-runner data: config.yaml: | -{{ toYaml .Values.forgejo_runner.config | indent 4 }} +{{ toYaml .Values.forgejo.runner.config | indent 4 }} {{- end }} \ No newline at end of file diff --git a/templates/gitea/runner-secret.yaml b/templates/gitea/runner-secret.yaml index 749c368..0ead4db 100644 --- a/templates/gitea/runner-secret.yaml +++ b/templates/gitea/runner-secret.yaml @@ -9,7 +9,7 @@ while the rest is the actual secret. It is possible to update the secret of an existing runner by running the command again on the Forgejo machine, with the last 24 characters updated. */}} -{{- if and (.Values.forgejo_runner.enabled) (not .Values.forgejo_runner.registrationSecretName) -}} +{{- if and (.Values.forgejo.runner.enabled) (not .Values.forgejo.runner.registrationSecretName) -}} {{- $secretName := printf "%s-%s" (include "gitea.fullname" .) "runner-registration" -}} {{- $secret := lookup "v1" "Secret" .Release.Namespace $secretName -}} {{- if not $secret }} diff --git a/templates/gitea/runner.yaml b/templates/gitea/runner.yaml index b43b58f..ee987c9 100644 --- a/templates/gitea/runner.yaml +++ b/templates/gitea/runner.yaml @@ -1,20 +1,20 @@ -{{- if .Values.forgejo_runner.enabled -}} +{{- if .Values.forgejo.runner.enabled -}} apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "gitea.fullname" . }}-runner labels: - {{- include "forgejo_runner.labels" . | nindent 4 }} + {{- include "forgejo.runner.labels" . | nindent 4 }} spec: - replicas: {{ .Values.forgejo_runner.replicas }} + replicas: {{ .Values.forgejo.runner.replicas }} selector: matchLabels: - {{- include "forgejo_runner.selectorLabels" . | nindent 6 }} + {{- include "forgejo.runner.selectorLabels" . | nindent 6 }} serviceName: {{ include "gitea.fullname" . }}-runner template: metadata: labels: - {{- include "forgejo_runner.labels" . | nindent 8 }} + {{- include "forgejo.runner.labels" . | nindent 8 }} spec: {{- if .Values.schedulerName }} schedulerName: "{{ .Values.schedulerName }}" @@ -28,7 +28,7 @@ spec: initContainers: - name: configure-runner image: "{{ include "gitea.actions-image" . }}" - imagePullPolicy: {{ default .Values.image.pullPolicy .Values.forgejo_runner.image.pullPolicy }} + imagePullPolicy: {{ default .Values.image.pullPolicy .Values.forgejo.runner.image.pullPolicy }} command: [ "forgejo-runner" ] args: - "create-runner-file" @@ -45,7 +45,7 @@ spec: containers: - name: {{ .Chart.Name }} image: "{{ include "gitea.actions-image" . }}" - imagePullPolicy: {{ default .Values.image.pullPolicy .Values.forgejo_runner.image.pullPolicy }} + imagePullPolicy: {{ default .Values.image.pullPolicy .Values.forgejo.runner.image.pullPolicy }} env: - name: DOCKER_HOST value: tcp://localhost:2376 diff --git a/values.yaml b/values.yaml index bfca7bd..73856fc 100644 --- a/values.yaml +++ b/values.yaml @@ -635,41 +635,42 @@ gitea: ## @section Forgejo Runner ## @descriptionStart The chart can deploy an [Actions Runner](https://forgejo.org/docs/latest/admin/actions/#forgejo-runner). ## -## The **Runner Configuration** `forgejo_runner.config` is simply the contents of the +## The **Runner Configuration** `forgejo.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 -## forgejo_runner: +## forgejo.runner: ## __config: ## ____runner: ## ______labels: ## ________- docker:docker://node:16-bullseye ## ``` ## @descriptionEnd -## @param forgejo_runner.config [object] contents of runner's config.yaml -## @param forgejo_runner.enabled Enable automatic deployment of a runner -## @param forgejo_runner.image.registry Image registry, e.g. gcr.io,docker.io -## @param forgejo_runner.image.repository Image to start for this pod -## @param forgejo_runner.image.tag Visit: [Image tag](https://code.forgejo.org/forgejo/-/packages/container/runner/versions). -## @param forgejo_runner.image.pullPolicy Overrides the pull policy set globally for actions runners -## @param forgejo_runner.registrationSecretName Name of secret containing the registration secret. If unset, the chart will create one -## @param forgejo_runner.replicas Number of replicas to automatically deploy -forgejo_runner: - enabled: false - config: - runner: - labels: - - docker:docker://node:16-bullseye - image: - registry: code.forgejo.org - repository: forgejo/runner - tag: 3.5.1 - pullPolicy: IfNotPresent - registrationSecretName: ~ - replicas: 1 +## @param forgejo.runner.config [object] contents of runner's config.yaml +## @param forgejo.runner.enabled Enable automatic deployment of a runner +## @param forgejo.runner.image.registry Image registry, e.g. gcr.io,docker.io +## @param forgejo.runner.image.repository Image to start for this pod +## @param forgejo.runner.image.tag Visit: [Image tag](https://code.forgejo.org/forgejo/-/packages/container/runner/versions). +## @param forgejo.runner.image.pullPolicy Overrides the pull policy set globally for actions runners +## @param forgejo.runner.registrationSecretName Name of secret containing the registration secret. If unset, the chart will create one +## @param forgejo.runner.replicas Number of replicas to automatically deploy +forgejo: + runner: + enabled: false + config: + runner: + labels: + - docker:docker://node:16-bullseye + image: + registry: code.forgejo.org + repository: forgejo/runner + tag: 3.5.1 + pullPolicy: IfNotPresent + registrationSecretName: ~ + replicas: 1 ## @section Redis® Cluster ## @descriptionStart