fix(forgejo-runner): add init container to fix cache permissions

This commit is contained in:
SeanOMik 2025-01-02 13:19:20 -05:00
parent e6f55840e2
commit 9423d5fd6d
Signed by: SeanOMik
GPG key ID: FEC9E2FC15235964
2 changed files with 13 additions and 3 deletions
kubernetes/main/apps/dev/forgejo-runner/app

View file

@ -59,7 +59,7 @@ data:
enabled: true
# The directory to store the cache data.
# If it's empty, the cache data will be stored in $HOME/.cache/actcache.
dir: "/cache"
dir: ""
# The host of the cache server.
# It's not for the address to listen, but the address to connect from job containers.
# So 0.0.0.0 is a bad choice, leave it empty to detect automatically.

View file

@ -50,10 +50,20 @@ spec:
volumeMounts:
- name: runner-data
mountPath: /data
# fix permissions of cache pvc
- command: ["sh", "-c", "chown -R 1000:1000 /data/.cache"]
image: busybox
volumeMounts:
- mountPath: /data/.cache/actcache
name: forgejo-runner-cache
name: fix-permissions
containers:
- name: runner
image: *runnerImg
command: ["sh", "-c", "while ! nc -z localhost 2376 </dev/null; do echo 'waiting for docker daemon...'; sleep 5; done; forgejo-runner daemon --config /data/config.yml"]
command:
- "sh"
- "-c"
- "while ! nc -z localhost 2376 </dev/null; do echo 'waiting for docker daemon...'; sleep 5; done; forgejo-runner daemon --config /data/config.yml"
env:
- name: DOCKER_HOST
value: tcp://localhost:2376
@ -70,7 +80,7 @@ spec:
mountPath: /data/config.yml
subPath: config.yml
- name: forgejo-runner-cache
mountPath: /cache
mountPath: /data/.cache/actcache
- name: daemon
image: docker:27.4.1-dind
env: