125 lines
3.7 KiB
YAML
125 lines
3.7 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: trade-next-act-runner
|
|
namespace: gitea-actions
|
|
labels:
|
|
app.kubernetes.io/name: trade-next-act-runner
|
|
app.kubernetes.io/part-of: trade-gitops
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: trade-next-act-runner
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: trade-next-act-runner
|
|
app.kubernetes.io/part-of: trade-gitops
|
|
spec:
|
|
nodeSelector:
|
|
kubernetes.io/hostname: sol
|
|
volumes:
|
|
- name: runner-data
|
|
hostPath:
|
|
path: /var/lib/trade-gitops/gitea-actions/runner-data
|
|
type: DirectoryOrCreate
|
|
- name: runner-config
|
|
configMap:
|
|
name: act-runner-config
|
|
- name: docker-sock
|
|
emptyDir:
|
|
sizeLimit: 1Gi
|
|
- name: dind-data
|
|
emptyDir:
|
|
sizeLimit: 20Gi
|
|
initContainers:
|
|
- name: register
|
|
image: docker.io/gitea/act_runner:latest
|
|
env:
|
|
- name: GITEA_INSTANCE_URL
|
|
value: https://gitea.mpabi.pl
|
|
- name: GITEA_RUNNER_NAME
|
|
value: trade-next-sol
|
|
- name: GITEA_RUNNER_LABELS
|
|
value: ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest,k3s-deploy:docker://docker.gitea.com/runner-images:ubuntu-latest
|
|
- name: GITEA_RUNNER_REGISTRATION_TOKEN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: act-runner-registration-token
|
|
key: token
|
|
command:
|
|
- /bin/sh
|
|
- -ec
|
|
args:
|
|
- |
|
|
if [ -f /data/.runner ]; then
|
|
echo "runner already registered"
|
|
exit 0
|
|
fi
|
|
act_runner --config /config/config.yaml register \
|
|
--no-interactive \
|
|
--instance "${GITEA_INSTANCE_URL}" \
|
|
--token "${GITEA_RUNNER_REGISTRATION_TOKEN}" \
|
|
--name "${GITEA_RUNNER_NAME}" \
|
|
--labels "${GITEA_RUNNER_LABELS}"
|
|
volumeMounts:
|
|
- name: runner-data
|
|
mountPath: /data
|
|
- name: runner-config
|
|
mountPath: /config
|
|
containers:
|
|
- name: dind
|
|
image: docker:27-dind
|
|
securityContext:
|
|
privileged: true
|
|
env:
|
|
- name: DOCKER_TLS_CERTDIR
|
|
value: ""
|
|
args:
|
|
- --host=tcp://127.0.0.1:2375
|
|
- --host=unix:///var/run/docker.sock
|
|
- --tls=false
|
|
resources:
|
|
requests:
|
|
cpu: 250m
|
|
memory: 256Mi
|
|
limits:
|
|
cpu: "1"
|
|
memory: 1Gi
|
|
volumeMounts:
|
|
- name: docker-sock
|
|
mountPath: /var/run
|
|
- name: dind-data
|
|
mountPath: /var/lib/docker
|
|
- name: runner
|
|
image: docker.io/gitea/act_runner:latest
|
|
env:
|
|
- name: CONFIG_FILE
|
|
value: /config/config.yaml
|
|
- name: GITEA_INSTANCE_URL
|
|
value: https://gitea.mpabi.pl
|
|
- name: DOCKER_HOST
|
|
value: tcp://127.0.0.1:2375
|
|
command:
|
|
- /bin/sh
|
|
- -ec
|
|
args:
|
|
- |
|
|
sleep 8
|
|
exec act_runner daemon --config /config/config.yaml
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 128Mi
|
|
limits:
|
|
cpu: 500m
|
|
memory: 512Mi
|
|
volumeMounts:
|
|
- name: runner-data
|
|
mountPath: /data
|
|
- name: runner-config
|
|
mountPath: /config
|
|
- name: docker-sock
|
|
mountPath: /var/run
|