Only create runner resources when enabled

This commit is contained in:
Stefan Bethke 2024-09-12 11:39:24 +02:00
parent 3839d314f1
commit e3bad27b7c
4 changed files with 6 additions and 3 deletions

View file

@ -261,6 +261,7 @@ spec:
{{- include "gitea.init-additional-mounts" . | nindent 12 }} {{- include "gitea.init-additional-mounts" . | nindent 12 }}
resources: resources:
{{- toYaml .Values.initContainers.resources | nindent 12 }} {{- toYaml .Values.initContainers.resources | nindent 12 }}
{{ if and .Values.gitea.actions.enabled .Values.forgejo.runner.enabled}}
- name: add-runner-secret - name: add-runner-secret
image: "{{ include "gitea.image" . }}" image: "{{ include "gitea.image" . }}"
command: ["/usr/sbin/add_runner_secret.sh"] command: ["/usr/sbin/add_runner_secret.sh"]
@ -303,6 +304,7 @@ spec:
{{- include "gitea.init-additional-mounts" . | nindent 12 }} {{- include "gitea.init-additional-mounts" . | nindent 12 }}
resources: resources:
{{- toYaml .Values.initContainers.resources | nindent 12 }} {{- toYaml .Values.initContainers.resources | nindent 12 }}
{{ end }}
terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }} terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}

View file

@ -224,7 +224,7 @@ stringData:
configure_oauth configure_oauth
echo '==== END GITEA CONFIGURATION ====' echo '==== END GITEA CONFIGURATION ===='
{{ if and .Values.gitea.actions.enabled .Values.forgejo.runner.enabled}}
add_runner_secret.sh: |- add_runner_secret.sh: |-
#!/usr/bin/env bash #!/usr/bin/env bash
@ -235,3 +235,4 @@ stringData:
forgejo forgejo-cli actions register --name "{{ include "gitea.fullname" . }}-runner" --secret "${RUNNER_SECRET}" forgejo forgejo-cli actions register --name "{{ include "gitea.fullname" . }}-runner" --secret "${RUNNER_SECRET}"
echo '==== END ADD RUNNER SECRET ====' echo '==== END ADD RUNNER SECRET ===='
{{ end }}

View file

@ -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 secret of an existing runner by running the command again on the
Forgejo machine, with the last 24 characters updated. Forgejo machine, with the last 24 characters updated.
*/}} */}}
{{- if and (.Values.forgejo.runner.enabled) (not .Values.forgejo.runner.registrationSecretName) -}} {{- if and .Values.gitea.actions.enabled .Values.forgejo.runner.enabled (not .Values.forgejo.runner.registrationSecretName) -}}
{{- $secretName := printf "%s-%s" (include "gitea.fullname" .) "runner-registration" -}} {{- $secretName := printf "%s-%s" (include "gitea.fullname" .) "runner-registration" -}}
{{- $secret := lookup "v1" "Secret" .Release.Namespace $secretName -}} {{- $secret := lookup "v1" "Secret" .Release.Namespace $secretName -}}
{{- if not $secret }} {{- if not $secret }}

View file

@ -1,4 +1,4 @@
{{- if .Values.forgejo.runner.enabled -}} {{- if and .Values.gitea.actions.enabled .Values.forgejo.runner.enabled -}}
apiVersion: apps/v1 apiVersion: apps/v1
kind: StatefulSet kind: StatefulSet
metadata: metadata: