140 lines
4.6 KiB
YAML
140 lines
4.6 KiB
YAML
|
|
---
|
||
|
|
# Second Forgejo Actions runner instance on the Pi, declaring ONLY the
|
||
|
|
# `deploy-arm64` label.
|
||
|
|
#
|
||
|
|
# Why: the Pi's original runner (forgejo-runner-arm64) serves every
|
||
|
|
# `runs-on: docker` job in the instance, so a long onionwire `ci` build (Rust,
|
||
|
|
# 20-40 min) holds the only `docker` slot and any site deploy queued behind it
|
||
|
|
# waits indefinitely - that is exactly how siriusgrowthsolutions.com sat on a
|
||
|
|
# stale page while deploy-site runs stayed in `waiting` (runs 1163/1164).
|
||
|
|
#
|
||
|
|
# Deploys are not CPU-bound the way CI is, so a separate runner instance is
|
||
|
|
# cheap; the labels are disjoint in both directions, so neither class can
|
||
|
|
# starve the other. Keep capacity 1: a deploy must not overlap itself (the Pi
|
||
|
|
# registry tag :latest and the k8s restartedAt patch are last-writer-wins).
|
||
|
|
apiVersion: apps/v1
|
||
|
|
kind: Deployment
|
||
|
|
metadata:
|
||
|
|
name: forgejo-runner-deploy-arm64
|
||
|
|
namespace: forgejo
|
||
|
|
labels:
|
||
|
|
app: forgejo-runner
|
||
|
|
arch: arm64
|
||
|
|
role: deploy
|
||
|
|
spec:
|
||
|
|
replicas: 1
|
||
|
|
selector:
|
||
|
|
matchLabels:
|
||
|
|
app: forgejo-runner
|
||
|
|
role: deploy
|
||
|
|
strategy:
|
||
|
|
type: Recreate
|
||
|
|
template:
|
||
|
|
metadata:
|
||
|
|
labels:
|
||
|
|
app: forgejo-runner
|
||
|
|
arch: arm64
|
||
|
|
role: deploy
|
||
|
|
spec:
|
||
|
|
nodeSelector:
|
||
|
|
kubernetes.io/hostname: rpi
|
||
|
|
tolerations:
|
||
|
|
- key: dedicated
|
||
|
|
operator: Equal
|
||
|
|
value: network
|
||
|
|
effect: PreferNoSchedule
|
||
|
|
securityContext:
|
||
|
|
supplementalGroups: [984]
|
||
|
|
initContainers:
|
||
|
|
# Self-registration, like the amd64 runner. runner.ini lives on the Pi
|
||
|
|
# host (/opt/siriusdevops/runner-deploy/data) so a pod restart reuses the
|
||
|
|
# existing registration instead of burning a single-use runner token.
|
||
|
|
- name: register
|
||
|
|
# Must be the multi-arch code.forgejo.org image: alex3305/
|
||
|
|
# forgejo-runner-dind ships an x86-64 binary in its arm64 manifest and
|
||
|
|
# dies with "exec format error" on the Pi.
|
||
|
|
image: code.forgejo.org/forgejo/runner:5.0.1
|
||
|
|
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 pi-deploy-arm64 \
|
||
|
|
--labels 'deploy-arm64:docker://node:20-bullseye' \
|
||
|
|
--config /config/config.toml
|
||
|
|
env:
|
||
|
|
- name: RUNNER_TOKEN
|
||
|
|
valueFrom:
|
||
|
|
secretKeyRef:
|
||
|
|
name: forgejo-runner-deploy-arm64-token
|
||
|
|
key: token
|
||
|
|
volumeMounts:
|
||
|
|
- name: config-toml
|
||
|
|
mountPath: /config/config.toml
|
||
|
|
subPath: deploy-arm64.toml
|
||
|
|
- name: data
|
||
|
|
mountPath: /data
|
||
|
|
containers:
|
||
|
|
- name: runner
|
||
|
|
image: code.forgejo.org/forgejo/runner:5.0.1
|
||
|
|
imagePullPolicy: IfNotPresent
|
||
|
|
command:
|
||
|
|
- forgejo-runner
|
||
|
|
- --config
|
||
|
|
- /config/config.toml
|
||
|
|
- daemon
|
||
|
|
env:
|
||
|
|
- name: DOCKER_HOST
|
||
|
|
value: unix:///var/run/docker.sock
|
||
|
|
securityContext:
|
||
|
|
privileged: true
|
||
|
|
runAsUser: 0
|
||
|
|
runAsGroup: 0
|
||
|
|
volumeMounts:
|
||
|
|
- name: docker-sock
|
||
|
|
mountPath: /var/run/docker.sock
|
||
|
|
- name: docker-static
|
||
|
|
mountPath: /usr/bin/docker
|
||
|
|
readOnly: true
|
||
|
|
- name: cli-plugins
|
||
|
|
mountPath: /usr/local/lib/docker/cli-plugins
|
||
|
|
readOnly: true
|
||
|
|
- name: config-toml
|
||
|
|
mountPath: /config/config.toml
|
||
|
|
subPath: deploy-arm64.toml
|
||
|
|
- name: data
|
||
|
|
mountPath: /data
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
cpu: 50m
|
||
|
|
memory: 128Mi
|
||
|
|
limits:
|
||
|
|
memory: 512Mi
|
||
|
|
volumes:
|
||
|
|
- name: docker-sock
|
||
|
|
hostPath:
|
||
|
|
path: /var/run/docker.sock
|
||
|
|
type: Socket
|
||
|
|
- name: docker-static
|
||
|
|
hostPath:
|
||
|
|
path: /usr/local/bin/docker-static
|
||
|
|
type: File
|
||
|
|
- name: cli-plugins
|
||
|
|
hostPath:
|
||
|
|
path: /opt/siriusdevops/runner/cli-plugins
|
||
|
|
type: DirectoryOrCreate
|
||
|
|
- name: config-toml
|
||
|
|
configMap:
|
||
|
|
name: forgejo-runner-config
|
||
|
|
- name: data
|
||
|
|
hostPath:
|
||
|
|
path: /opt/siriusdevops/runner-deploy/data
|
||
|
|
type: DirectoryOrCreate
|