2023-08-17 09:26:35 +00:00
|
|
|
# Secret data.
|
|
|
|
# Alternatively, create this with
|
|
|
|
# kubectl create secret generic runner-secret --from-literal=token=your_offline_token_here
|
2023-06-12 06:35:27 +00:00
|
|
|
apiVersion: v1
|
2023-08-17 09:26:35 +00:00
|
|
|
stringData:
|
|
|
|
token: your_offline_secret_here
|
2023-06-12 06:35:27 +00:00
|
|
|
kind: Secret
|
|
|
|
metadata:
|
|
|
|
name: runner-secret
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: act-runner
|
|
|
|
name: act-runner
|
|
|
|
spec:
|
2023-08-17 09:26:35 +00:00
|
|
|
# Two replicas means that if one is busy, the other can pick up jobs.
|
|
|
|
replicas: 2
|
2023-06-12 06:35:27 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: act-runner
|
|
|
|
strategy: {}
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
creationTimestamp: null
|
|
|
|
labels:
|
|
|
|
app: act-runner
|
|
|
|
spec:
|
|
|
|
restartPolicy: Always
|
|
|
|
volumes:
|
|
|
|
- name: runner-data
|
2023-08-17 09:26:35 +00:00
|
|
|
emptyDir: {}
|
|
|
|
# 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:2.4.0
|
|
|
|
command: [ "sh", "-c", "cd /data && forgejo-runner create-runner-file --instance $GITEA_INSTANCE_URL --secret $RUNNER_SECRET --connect" ]
|
|
|
|
env:
|
|
|
|
- name: RUNNER_SECRET
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: runner-secret
|
|
|
|
key: token
|
|
|
|
- name: GITEA_INSTANCE_URL
|
|
|
|
value: http://gitea-http.gitea.svc.cluster.local:3000
|
|
|
|
volumeMounts:
|
|
|
|
- name: runner-data
|
|
|
|
mountPath: /data
|
2023-06-12 06:35:27 +00:00
|
|
|
containers:
|
|
|
|
- name: runner
|
2023-06-15 05:27:35 +00:00
|
|
|
image: gitea/act_runner:nightly-dind-rootless
|
2023-06-12 06:35:27 +00:00
|
|
|
imagePullPolicy: Always
|
|
|
|
env:
|
|
|
|
- name: DOCKER_HOST
|
|
|
|
value: tcp://localhost:2376
|
|
|
|
- name: DOCKER_CERT_PATH
|
|
|
|
value: /certs/client
|
|
|
|
- name: DOCKER_TLS_VERIFY
|
|
|
|
value: "1"
|
|
|
|
- name: GITEA_INSTANCE_URL
|
|
|
|
value: http://gitea-http.gitea.svc.cluster.local:3000
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
volumeMounts:
|
|
|
|
- name: runner-data
|
|
|
|
mountPath: /data
|
|
|
|
|