Added Gitea action runner deployments

This commit is contained in:
Danny Bessems 2024-02-28 11:07:24 +11:00
parent c23ec8ddac
commit bbd8eed2f5
16 changed files with 246 additions and 44 deletions

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: runner-config
namespace: gitea
data:
dind-config.yml: |
runner:
capacity: 2
labels: [dind:docker://node:21-bullseye]
dind-rootless-config.yml: |
runner:
capacity: 2
labels: [dind-rootless:docker://node:21-bullseye]

View File

@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: act-runner-dind-rootless
name: act-runner-dind-rootless
namespace: gitea
spec:
replicas: 1
selector:
matchLabels:
app: act-runner-dind-rootless
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: act-runner-dind-rootless
spec:
hostname: act-runner-dind-rootless
restartPolicy: Always
volumes:
- name: runner-config
configMap:
name: runner-config
items:
- key: dind-rootless-config.yml
path: dind-rootless-config.yml
- name: docker-certs
emptyDir: {}
- name: runner-data
persistentVolumeClaim:
claimName: act-runner-dind-rootless
securityContext:
fsGroup: 1000
containers:
- name: runner
image: gitea/act_runner:nightly-dind-rootless
imagePullPolicy: Always
env:
- name: CONFIG_FILE
value: /opt/act/config.yml
- 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.gitea.svc.cluster.local:3000
- name: GITEA_RUNNER_LABELS
value: dind-rootless:docker://node:16-bullseye
- name: GITEA_RUNNER_REGISTRATION_TOKEN
valueFrom:
secretKeyRef:
name: runner-secret
key: token
securityContext:
privileged: true
volumeMounts:
- name: runner-data
mountPath: /data
- name: runner-config
mountPath: /opt/act/config.yml
subPath: dind-rootless-config.yml

View File

@ -0,0 +1,75 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: act-runner-dind
name: act-runner-dind
namespace: gitea
spec:
replicas: 1
selector:
matchLabels:
app: act-runner-dind
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: act-runner-dind
spec:
hostname: act-runner-dind
restartPolicy: Always
volumes:
- name: runner-config
configMap:
name: runner-config
items:
- key: dind-config.yml
path: dind-config.yml
- name: docker-certs
emptyDir: {}
- name: runner-data
persistentVolumeClaim:
claimName: act-runner-dind
containers:
- name: runner
image: gitea/act_runner:nightly
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:
- name: CONFIG_FILE
value: /opt/act/config.yml
- 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.gitea.svc.cluster.local:3000
- name: GITEA_RUNNER_LABELS
value: dind:docker://node:16-bullseye
- name: GITEA_RUNNER_REGISTRATION_TOKEN
valueFrom:
secretKeyRef:
name: runner-secret
key: token
volumeMounts:
- name: runner-config
mountPath: /opt/act/config.yml
subPath: dind-config.yml
- name: docker-certs
mountPath: /certs
- name: runner-data
mountPath: /data
- name: daemon
image: docker:23.0.6-dind
args:
- --mtu=1400
env:
- name: DOCKER_TLS_CERTDIR
value: /certs
securityContext:
privileged: true
volumeMounts:
- name: docker-certs
mountPath: /certs

View File

@ -1,25 +0,0 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: flexvolsmb-gitea-data
namespace: gitea
spec:
accessModes:
- ReadWriteMany
storageClassName: flexvolsmb-gitea-data
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: flexvolsmb-gitea-ssh
namespace: gitea
spec:
accessModes:
- ReadWriteMany
storageClassName: flexvolsmb-gitea-ssh
resources:
requests:
storage: 1Gi

View File

@ -16,22 +16,3 @@ spec:
opts: file_mode=0777,dir_mode=0777,uid=1000,gid=1000,iocharset=utf8,nobrl opts: file_mode=0777,dir_mode=0777,uid=1000,gid=1000,iocharset=utf8,nobrl
server: 192.168.154.225 server: 192.168.154.225
share: /K3s.Volumes/gitea/data share: /K3s.Volumes/gitea/data
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: flexvolsmb-gitea-ssh
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
storageClassName: flexvolsmb-gitea-ssh
flexVolume:
driver: mount/smb
secretRef:
name: flexvolsmb-credentials
options:
opts: file_mode=0600,dir_mode=0600,iocharset=utf8
server: 192.168.154.225
share: /K3s.Volumes/gitea/ssh

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: flexvolsmb-gitea-runner
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
storageClassName: flexvolsmb-gitea-runner
flexVolume:
driver: mount/smb
secretRef:
name: flexvolsmb-credentials
options:
opts: file_mode=0777,dir_mode=0777,uid=1000,gid=1000,iocharset=utf8
server: 192.168.154.225
share: /K3s.Volumes/gitea/runner

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: flexvolsmb-gitea-ssh
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
storageClassName: flexvolsmb-gitea-ssh
flexVolume:
driver: mount/smb
secretRef:
name: flexvolsmb-credentials
options:
opts: file_mode=0600,dir_mode=0600,iocharset=utf8
server: 192.168.154.225
share: /K3s.Volumes/gitea/ssh

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: act-runner-dind-rootless
namespace: gitea
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 1Gi

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: act-runner-dind
namespace: gitea
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 1Gi

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: flexvolsmb-gitea-data
namespace: gitea
spec:
accessModes:
- ReadWriteMany
storageClassName: flexvolsmb-gitea-data
resources:
requests:
storage: 1Gi

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: flexvolsmb-gitea-ssh
namespace: gitea
spec:
accessModes:
- ReadWriteMany
storageClassName: flexvolsmb-gitea-ssh
resources:
requests:
storage: 1Gi

View File

@ -0,0 +1,8 @@
apiVersion: v1
data:
token: bjF2R1hHZXVjRVlyaU95aXZaREhrVDlFNVJ0MHptMTJ6Z1kzcTE1TQ==
kind: Secret
metadata:
name: runner-secret
namespace: gitea
type: Opaque