Pulling proposal from #70 and applying some fixes

This commit is contained in:
Lukas 2024-05-17 21:36:17 +02:00
parent 89a7ccacb0
commit a3520cc877
No known key found for this signature in database
GPG key ID: B7940328383214B0
5 changed files with 69 additions and 16 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
name: forgejo-runner
description: Deploy runner for an forgejo instance (default codeberg.org)
type: application
version: 0.1.17
version: 0.1.19
# renovate: image=code.forgejo.org/forgejo/runner
appVersion: "3.4.1"
maintainers:

View file

@ -2,7 +2,7 @@
= forgejo-runner
image::https://img.shields.io/badge/Version-0.1.17-informational?style=flat-square[Version: 0.1.17]
image::https://img.shields.io/badge/Version-0.1.19-informational?style=flat-square[Version: 0.1.19]
image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application]
image::https://img.shields.io/badge/AppVersion-3.4.1-informational?style=flat-square[AppVersion: 3.4.1]
== Maintainers
@ -89,7 +89,7 @@ helm uninstall forgejo-runner-release
| dind.image.tag
| string
| `"26.1.2-dind"`
| `"26.1.3-dind"`
|
| fullnameOverride
@ -139,7 +139,7 @@ helm uninstall forgejo-runner-release
| kubectl.image.tag
| string
| `"1.30.0"`
| `"1.30.1"`
|
| nameOverride

View file

@ -34,14 +34,7 @@ spec:
- name: make-config-writeable
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: [ "sh", "-c" ]
args:
- |
cp /etc/runner/.runner /data/.runner && forgejo-runner generate-config > /data/config.yml ;
sed -i -e "s|network: .*|network: host|" config.yml ;
sed -i -e "s|^ envs:$$| envs:\n DOCKER_HOST: tcp://localhost:2376\n DOCKER_TLS_VERIFY: 1\n DOCKER_CERT_PATH: /certs/client|" config.yml ;
sed -i -e "s|^ options:| options: -v /certs/client:/certs/client|" config.yml ;
sed -i -e "s| valid_volumes: \[\]$$| valid_volumes:\n - /certs/client|" config.yml ;
command: [ "/bin/cp", "/etc/runner/.runner", "/data/.runner" ]
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
@ -55,17 +48,27 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["sh", "-c", "while ! nc -z localhost 2376 </dev/null; do echo 'waiting for docker daemon...'; sleep 5; done; forgejo-runner --config config.yml daemon"]
command:
- "sh"
- "-c"
- |
while ! nc -z 127.0.0.1 2376 </dev/null; do
echo 'waiting for docker daemon...';
sleep 5;
done
/bin/forgejo-runner --config /etc/runner/config.yaml daemon
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: DOCKER_HOST
value: tcp://localhost:2376
value: tcp://127.0.0.1:2376
- name: DOCKER_CERT_PATH
value: /certs/client
- name: DOCKER_TLS_VERIFY
value: "1"
volumeMounts:
- name: runner-configfile
mountPath: /etc/runner
- name: docker-certs
mountPath: /certs
- name: runner-data
@ -94,6 +97,9 @@ spec:
- name: runner-config
secret:
secretName: {{ .Values.runner.config.existingSecret | default (print ( include "forgejo-runner.fullname" . ) "-config") | quote }}
- name: runner-configfile
secret:
secretName: {{ include "forgejo-runner.fullname" . }}-configfile
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}

View file

@ -0,0 +1,11 @@
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "forgejo-runner.fullname" . }}-configfile
labels:
{{- include "forgejo-runner.labels" . | nindent 4 }}
annotations:
config-hash: {{ toYaml .Values.runner.config.file | sha256sum }}
data:
config.yaml: {{ toYaml .Values.runner.config.file | b64enc }}

View file

@ -24,19 +24,55 @@ runner:
instance: https://codeberg.org
name:
token:
file:
log:
# -- The level of logging, can be trace, debug, info, warn, error, fatal
# @section -- Configuration yaml of runner (see: https://code.forgejo.org/forgejo/runner/src/branch/main/internal/pkg/config/config.example.yaml)
level: "info"
runner:
# -- Runner config which contains id and token of this runner (autogenerate with create)
# @section -- Configuration yaml of runner (see: https://code.forgejo.org/forgejo/runner/src/branch/main/internal/pkg/config/config.example.yaml)
file: ".runner"
# -- Execute how many tasks concurrently at the same time.
# @section -- Configuration yaml of runner (see: https://code.forgejo.org/forgejo/runner/src/branch/main/internal/pkg/config/config.example.yaml)
capacity: 1
# -- Extra environment variables to run jobs.
# @section -- Configuration yaml of runner (see: https://code.forgejo.org/forgejo/runner/src/branch/main/internal/pkg/config/config.example.yaml)
envs:
DOCKER_HOST: tcp://127.0.0.1:2376
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: /certs/client
container:
# -- Specifies the network to which the container will connect.
# Could be host, bridge or the name of a custom network.
# If it's empty, create a network automatically.
# @section -- Configuration yaml of runner (see: https://code.forgejo.org/forgejo/runner/src/branch/main/internal/pkg/config/config.example.yaml)
network: host
# -- Whether to create networks with IPv6 enabled. Requires the Docker daemon to be set up accordingly.
# Only takes effect if "network" is set to "".
# @section -- Configuration yaml of runner (see: https://code.forgejo.org/forgejo/runner/src/branch/main/internal/pkg/config/config.example.yaml)
enable_ipv6: false
# -- And other options to be used when the container is started (eg, --add-host=my.forgejo.url:host-gateway).
# @section -- Configuration yaml of runner (see: https://code.forgejo.org/forgejo/runner/src/branch/main/internal/pkg/config/config.example.yaml)
privileged: false
# -- And other options to be used when the container is started (eg, --add-host=my.forgejo.url:host-gateway).
# @section -- Configuration yaml of runner (see: https://code.forgejo.org/forgejo/runner/src/branch/main/internal/pkg/config/config.example.yaml)
options: -v /certs/client:/certs/client
valid_volumes:
- /certs/client
dind:
image:
registry: docker.io
repository: library/docker
pullPolicy: IfNotPresent
tag: 26.1.2-dind
tag: 26.1.3-dind
kubectl:
image:
registry: docker.io
repository: bitnami/kubectl
pullPolicy: IfNotPresent
tag: 1.30.0
tag: 1.30.1
serviceAccount:
# Specifies whether a service account should be created