[FORGEJO] simplify Kubernetes examples with offline registration
This commit is contained in:
parent
d4eb913533
commit
16dec924c8
2 changed files with 50 additions and 47 deletions
|
@ -1,22 +1,12 @@
|
||||||
kind: PersistentVolumeClaim
|
# Secret data.
|
||||||
|
# Alternatively, create this with
|
||||||
|
# kubectl create secret generic runner-secret --from-literal=token=your_offline_token_here
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
metadata:
|
stringData:
|
||||||
name: act-runner-vol
|
token: your_offline_secret_here
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 1Gi
|
|
||||||
storageClassName: standard
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
data:
|
|
||||||
token: << base64 encoded registration token >>
|
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
name: runner-secret
|
name: runner-secret
|
||||||
type: Opaque
|
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
|
@ -25,7 +15,8 @@ metadata:
|
||||||
app: act-runner
|
app: act-runner
|
||||||
name: act-runner
|
name: act-runner
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
# Two replicas means that if one is busy, the other can pick up jobs.
|
||||||
|
replicas: 2
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: act-runner
|
app: act-runner
|
||||||
|
@ -41,8 +32,24 @@ spec:
|
||||||
- name: docker-certs
|
- name: docker-certs
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
- name: runner-data
|
- name: runner-data
|
||||||
persistentVolumeClaim:
|
emptyDir: {}
|
||||||
claimName: act-runner-vol
|
# 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
|
||||||
containers:
|
containers:
|
||||||
- name: runner
|
- name: runner
|
||||||
image: gitea/act_runner:nightly
|
image: gitea/act_runner:nightly
|
||||||
|
@ -56,11 +63,6 @@ spec:
|
||||||
value: "1"
|
value: "1"
|
||||||
- name: GITEA_INSTANCE_URL
|
- name: GITEA_INSTANCE_URL
|
||||||
value: http://gitea-http.gitea.svc.cluster.local:3000
|
value: http://gitea-http.gitea.svc.cluster.local:3000
|
||||||
- name: GITEA_RUNNER_REGISTRATION_TOKEN
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: runner-secret
|
|
||||||
key: token
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: docker-certs
|
- name: docker-certs
|
||||||
mountPath: /certs
|
mountPath: /certs
|
||||||
|
|
|
@ -1,22 +1,12 @@
|
||||||
kind: PersistentVolumeClaim
|
# Secret data.
|
||||||
|
# Alternatively, create this with
|
||||||
|
# kubectl create secret generic runner-secret --from-literal=token=your_offline_token_here
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
metadata:
|
stringData:
|
||||||
name: act-runner-vol
|
token: your_offline_secret_here
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 1Gi
|
|
||||||
storageClassName: standard
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
data:
|
|
||||||
token: << runner registration token goes here >>
|
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
name: runner-secret
|
name: runner-secret
|
||||||
type: Opaque
|
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
|
@ -25,7 +15,8 @@ metadata:
|
||||||
app: act-runner
|
app: act-runner
|
||||||
name: act-runner
|
name: act-runner
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
# Two replicas means that if one is busy, the other can pick up jobs.
|
||||||
|
replicas: 2
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: act-runner
|
app: act-runner
|
||||||
|
@ -39,13 +30,28 @@ spec:
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
volumes:
|
volumes:
|
||||||
- name: runner-data
|
- name: runner-data
|
||||||
persistentVolumeClaim:
|
emptyDir: {}
|
||||||
claimName: act-runner-vol
|
# 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
|
||||||
containers:
|
containers:
|
||||||
- name: runner
|
- name: runner
|
||||||
image: gitea/act_runner:nightly-dind-rootless
|
image: gitea/act_runner:nightly-dind-rootless
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
# command: ["sh", "-c", "while ! nc -z localhost 2376 </dev/null; do echo 'waiting for docker daemon...'; sleep 5; done; /sbin/tini -- /opt/act/run.sh"]
|
|
||||||
env:
|
env:
|
||||||
- name: DOCKER_HOST
|
- name: DOCKER_HOST
|
||||||
value: tcp://localhost:2376
|
value: tcp://localhost:2376
|
||||||
|
@ -55,11 +61,6 @@ spec:
|
||||||
value: "1"
|
value: "1"
|
||||||
- name: GITEA_INSTANCE_URL
|
- name: GITEA_INSTANCE_URL
|
||||||
value: http://gitea-http.gitea.svc.cluster.local:3000
|
value: http://gitea-http.gitea.svc.cluster.local:3000
|
||||||
- name: GITEA_RUNNER_REGISTRATION_TOKEN
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: runner-secret
|
|
||||||
key: token
|
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
|
|
Loading…
Reference in a new issue