From 326be2e057b60dd91d2116f2fa4c3836babc5da4 Mon Sep 17 00:00:00 2001 From: rock Date: Mon, 7 Sep 2026 05:27:30 +0000 Subject: [PATCH] fix: always re-register runner to keep labels in sync (#2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem Init container skips registration if `.runner` file exists on PVC: ``` test -f /data/.runner || forgejo-runner register ... ``` This means changing runner labels in `values.yaml` (e.g. the label image fix from PR #1) has **no effect** until PVCs are manually deleted — not GitOps-friendly. ## Fix Always delete `.runner` and re-register on every pod start: ``` rm -f /data/.runner forgejo-runner register --no-interactive ... ``` Labels now stay in sync with `values.yaml` automatically. ArgoCD syncs → pods restart → init re-registers with current labels. ## Files Changed - `k8s/infra/forgejo-runner/templates/deployment.yaml` (init container logic) ## After Merge ArgoCD syncs → deployment spec changes → pods restart → init re-registers with new labels from PR #1 → CI works across all repos.Reviewed-on: https://forgejo.riotpiao.com/rock/homelab/pulls/2 Co-authored-by: rock --- k8s/infra/forgejo-runner/templates/deployment.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/k8s/infra/forgejo-runner/templates/deployment.yaml b/k8s/infra/forgejo-runner/templates/deployment.yaml index f60ab36..2ef614f 100644 --- a/k8s/infra/forgejo-runner/templates/deployment.yaml +++ b/k8s/infra/forgejo-runner/templates/deployment.yaml @@ -34,7 +34,11 @@ spec: command: ["sh", "-c"] args: - | - test -f /data/.runner || forgejo-runner register --no-interactive \ + # Always re-register to keep labels in sync with values.yaml. + # Without this, changing a runner label requires manually deleting + # the PVC or .runner file — not GitOps-friendly. + rm -f /data/.runner + forgejo-runner register --no-interactive \ --instance {{ .Values.runner.forgejoUrl }} \ --token $(RUNNER_TOKEN) \ --name {{ .Values.runner.name }} \