Runner: place it by node label and give DinD capped local disk
Demo / hello (push) Successful in 27s
Demo / hello (push) Successful in 27s
- Schedule the runner only on a node labeled eom.dev/ci-runner=true, and fail the deploy with a clear message if no node has the label. - Put DinD's /var/lib/docker on an emptyDir with a 50Gi sizeLimit, so Docker data uses local disk (overlay2 doesn't work on the NFS storage classes) and has a known cap. - Request 20Gi and limit 55Gi of ephemeral storage on DinD, which also keeps the scheduler off small-disk nodes. All sizes are role defaults. Which node gets the label is Eric's call. Refs DevOps/software-infrastructure#36 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,3 +40,21 @@ gitea_actions_enabled: true
|
||||
gitea_actions_chart_version: 0.1.2
|
||||
gitea_actions_runner_replicas: 1
|
||||
gitea_actions_runner_token_secret: gitea-actions-runner-token
|
||||
|
||||
# Where the runner runs and how much disk Docker-in-Docker may use.
|
||||
# The runner only schedules on a node carrying this label. Choose a node with
|
||||
# real local disk (the cluster's NFS storage classes don't suit overlay2) and
|
||||
# label it once:
|
||||
# kubectl label node <node> eom.dev/ci-runner=true
|
||||
# The role checks for the label before deploying. Labels live on the node, so
|
||||
# re-label it if the node is rebuilt.
|
||||
gitea_actions_runner_node_selector:
|
||||
eom.dev/ci-runner: "true"
|
||||
# DinD's /var/lib/docker goes on an emptyDir on that node's local disk, capped
|
||||
# here. The kubelet evicts the pod if the cap is exceeded, so S5's cleanup has
|
||||
# to keep usage well below it. One runner image is about 5 GB.
|
||||
gitea_actions_docker_data_size: 50Gi
|
||||
# Ephemeral storage for the DinD container, which holds the emptyDir above.
|
||||
# The request also keeps the scheduler off nodes with small disks.
|
||||
gitea_actions_dind_ephemeral_request: 20Gi
|
||||
gitea_actions_dind_ephemeral_limit: 55Gi
|
||||
|
||||
@@ -45,6 +45,22 @@
|
||||
token: "{{ runner_token.stdout | trim }}"
|
||||
no_log: true
|
||||
|
||||
- name: find the node labeled for the runner
|
||||
kubernetes.core.k8s_info:
|
||||
kind: Node
|
||||
label_selectors: "{{ gitea_actions_runner_node_selector.items() | map('join', '=') | list }}"
|
||||
register: runner_nodes
|
||||
|
||||
- name: require a node labeled for the runner
|
||||
ansible.builtin.assert:
|
||||
that: runner_nodes.resources | length > 0
|
||||
fail_msg: >-
|
||||
No node matches {{ gitea_actions_runner_node_selector }}. Label a node
|
||||
with enough local disk for Docker-in-Docker, for example
|
||||
`kubectl label node <node> eom.dev/ci-runner=true`, then rerun with
|
||||
--tags actions.
|
||||
quiet: true
|
||||
|
||||
- name: deploy gitea actions runner
|
||||
kubernetes.core.helm:
|
||||
name: gitea-actions
|
||||
@@ -61,6 +77,21 @@
|
||||
replicas: "{{ gitea_actions_runner_replicas }}"
|
||||
persistence:
|
||||
size: 1Gi
|
||||
# Chart 0.1.2 renders nodeSelector correctly for one key only.
|
||||
nodeSelector: "{{ gitea_actions_runner_node_selector }}"
|
||||
extraVolumes:
|
||||
- name: docker-data
|
||||
emptyDir:
|
||||
sizeLimit: "{{ gitea_actions_docker_data_size }}"
|
||||
dind:
|
||||
extraVolumeMounts:
|
||||
- name: docker-data
|
||||
mountPath: /var/lib/docker
|
||||
resources:
|
||||
requests:
|
||||
ephemeral-storage: "{{ gitea_actions_dind_ephemeral_request }}"
|
||||
limits:
|
||||
ephemeral-storage: "{{ gitea_actions_dind_ephemeral_limit }}"
|
||||
runner:
|
||||
config: |
|
||||
log:
|
||||
|
||||
Reference in New Issue
Block a user