From 700a6de5bcaa091ac7bfa051f27ba96e5fa6a931 Mon Sep 17 00:00:00 2001 From: xyhhx Date: Mon, 27 Nov 2023 16:41:09 -0500 Subject: [PATCH 1/2] docs: update kubernetes dind example --- examples/kubernetes/dind-docker.yaml | 33 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/examples/kubernetes/dind-docker.yaml b/examples/kubernetes/dind-docker.yaml index 7abf9e0..0dd0aea 100644 --- a/examples/kubernetes/dind-docker.yaml +++ b/examples/kubernetes/dind-docker.yaml @@ -1,4 +1,5 @@ # Secret data. +# You will need to retrive this from the web UI, and your Forgejo instance must be running v1.21+ # Alternatively, create this with # kubectl create secret generic runner-secret --from-literal=token=your_offline_token_here apiVersion: v1 @@ -36,20 +37,24 @@ spec: # Initialise our configuration file using offline registration # https://forgejo.org/docs/v1.21/admin/actions/#offline-registration initContainers: - - name: runner-config-generation - image: code.forgejo.org/forgejo/runner:3.0.0 - command: [ "forgejo-runner create-runner-file --instance $FORGEJO_INSTANCE_URL --secret $RUNNER_SECRET --connect" ] - env: - - name: RUNNER_SECRET - valueFrom: - secretKeyRef: - name: runner-secret - key: token - - name: FORGEJO_INSTANCE_URL - value: http://gitea-http.gitea.svc.cluster.local:3000 - volumeMounts: - - name: runner-data - mountPath: /data + - name: runner-register + image: code.forgejo.org/forgejo/runner:3.2.0 + command: ["forgejo-runner", "register", "--no-interactive", "--token", $(RUNNER_SECRET), "--name", "runner", "--instance", $(FORGEJO_INSTANCE_URL)] + env: + - name: RUNNER_SECRET + valueFrom: + secretKeyRef: + name: forgejo-runner-secret + key: token + - name: FORGEJO_INSTANCE_URL + value: http://forgejo-http.forgejo.svc.cluster.local:3000 + resources: + limits: + cpu: "0.50" + memory: "64Mi" + volumeMounts: + - name: runner-data + mountPath: /data containers: - name: runner image: code.forgejo.org/forgejo/runner:3.0.0 From 52b952be0f8795fdb9ea44d829b718ecc48e0ed0 Mon Sep 17 00:00:00 2001 From: xyhhx Date: Tue, 28 Nov 2023 01:08:54 +0000 Subject: [PATCH 2/2] docs(example/kubernetes): use pod names as runner names --- examples/kubernetes/dind-docker.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/kubernetes/dind-docker.yaml b/examples/kubernetes/dind-docker.yaml index 0dd0aea..44386b8 100644 --- a/examples/kubernetes/dind-docker.yaml +++ b/examples/kubernetes/dind-docker.yaml @@ -39,8 +39,12 @@ spec: initContainers: - name: runner-register image: code.forgejo.org/forgejo/runner:3.2.0 - command: ["forgejo-runner", "register", "--no-interactive", "--token", $(RUNNER_SECRET), "--name", "runner", "--instance", $(FORGEJO_INSTANCE_URL)] + command: ["forgejo-runner", "register", "--no-interactive", "--token", $(RUNNER_SECRET), "--name", $(RUNNER_NAME), "--instance", $(FORGEJO_INSTANCE_URL)] env: + - name: RUNNER_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name - name: RUNNER_SECRET valueFrom: secretKeyRef: