homek8s/apps/base/forgejo/runner-amd64.yaml
2026-09-18 23:25:19 -04:00

147 lines
3.9 KiB
YAML

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: forgejo-runner-amd64
namespace: forgejo
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: forgejo-runner-amd64
namespace: forgejo
labels:
app: forgejo-runner
arch: amd64
spec:
replicas: 2
selector:
matchLabels:
app: forgejo-runner
arch: amd64
strategy:
type: Recreate
template:
metadata:
labels:
app: forgejo-runner
arch: amd64
spec:
nodeSelector:
kubernetes.io/hostname: siriussec
securityContext:
fsGroup: 0
initContainers:
- name: register
image: alex3305/forgejo-runner-dind:13-dind-rootless-28
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
set -e
if [ -s /data/runner.ini ]; then
echo already-registered
exit 0
fi
forgejo-runner register --no-interactive \
--instance https://forgejo.siriusdevops.com \
--token "$RUNNER_TOKEN" \
--name siriussec-amd64 \
--labels 'docker-amd64:docker://node:20-bullseye,amd64:docker://node:20-bullseye' \
--config /config/config.toml
env:
- name: RUNNER_TOKEN
valueFrom:
secretKeyRef:
name: forgejo-runner-amd64-token
key: token
volumeMounts:
- name: config-toml
mountPath: /config/config.toml
subPath: amd64.toml
- name: data
mountPath: /data
containers:
- name: dind
image: docker:27-dind
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
dockerd --host=unix:///var/run/docker.sock --tls=false --mtu=1420 &
pid=$!
i=0
while [ "$i" -lt 30 ]; do
if [ -S /var/run/docker.sock ]; then
chmod 666 /var/run/docker.sock
break
fi
i=$((i+1))
sleep 1
done
wait "$pid"
securityContext:
privileged: true
volumeMounts:
- name: dind-run
mountPath: /var/run
- name: data
mountPath: /var/lib/docker
subPath: docker
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
memory: 4Gi
- name: runner
image: code.forgejo.org/forgejo/runner:5.0.1
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
set -e
i=0
while [ "$i" -lt 60 ]; do
if [ -S /var/run/docker.sock ]; then
break
fi
i=$((i+1))
sleep 2
done
exec forgejo-runner --config /config/config.toml daemon
env:
- name: DOCKER_HOST
value: unix:///var/run/docker.sock
volumeMounts:
- name: config-toml
mountPath: /config/config.toml
subPath: amd64.toml
- name: data
mountPath: /data
- name: dind-run
mountPath: /var/run
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
memory: 512Mi
volumes:
- name: config-toml
configMap:
name: forgejo-runner-config
- name: data
persistentVolumeClaim:
claimName: forgejo-runner-amd64
- name: dind-run
emptyDir: {}