Files
claudeandClaude Opus 5.5 96e5b92bec
Demo / hello (push) Successful in 16s
Runner: turn on the Actions dependency cache (G8)
The runner's built-in cache server now backs actions/cache.

- In the cluster, cache blobs go on a new PVC (gitea-actions-cache, 20Gi,
  default storage class) mounted at /cache in the runner container, so the
  cache survives runner restarts. The role creates the PVC before the
  Helm release. NFS doesn't enforce the size; the runner's own expiry
  (unused 7 days, or older than 30 days) keeps it bounded.
- Fixed port 8088. Job containers reach it at the pod IP, which DinD's
  per-job networks route to because DinD shares the pod's network.
- The dedicated-host runner gets the same config, with the cache on a
  bind mount under gitea_actions_host_dir.
- gitea_actions_cache_enabled: false turns it all off again.

Refs DevOps/software-infrastructure#56

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:22:21 -05:00

197 lines
9.4 KiB
YAML

#SPDX-License-Identifier: MIT-0
---
# defaults file for ansible-role-gitea
# CIDRs allowed to set X-Forwarded-For / X-Real-IP for Gitea.
# 10.244.0.0/16 is the cluster pod network, where ingress-nginx runs.
gitea_trusted_proxies: "127.0.0.0/8,::1/128,10.244.0.0/16"
# Credentials, one per purpose. Each defaults to gitea_admin_password, which
# is how the role worked before they were separate, so applying the role with
# no new vault variables changes nothing. To give one its own value, define it
# in the vault and follow docs/ci-cd/credentials.md in software-infrastructure:
# some need a matching change outside the chart first.
gitea_mailer_password: "{{ gitea_admin_password }}"
gitea_postgresql_password: "{{ gitea_admin_password }}"
# Resources for chart subcharts. These match the limits previously set by
# hand on the live StatefulSets; the bitnami default presets (192Mi) OOM.
gitea_valkey_resources:
requests:
cpu: 100m
memory: 1Gi
ephemeral-storage: 50Mi
limits:
cpu: 150m
memory: 8Gi
ephemeral-storage: 4Gi
# PostgreSQL needs real CPU: at 150m its liveness probe (pg_isready, 5s
# timeout) times out under load and the kubelet restarts it.
gitea_postgresql_resources:
requests:
cpu: 250m
memory: 128Mi
ephemeral-storage: 50Mi
limits:
cpu: "1"
memory: 2Gi
ephemeral-storage: 2Gi
# Gitea's Helm chart (gitea/gitea). Pinned so a rerun of the role never
# upgrades Gitea by surprise. 12.7.0 ships Gitea 1.27.0 and is the version
# deployed on 2026-11-09. Bump it deliberately, after reading the chart's
# release notes.
gitea_chart_version: 12.7.0
# Gitea Actions runner (gitea/actions chart)
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
# Docker cleanup (S5). A sidecar runs files/docker-prune.sh against DinD every
# interval. It removes stopped containers, unused volumes, dangling images and
# build cache older than max_age, and when Docker uses more than
# images_above_gb it also removes every unused image except the job images
# below. Nothing a container uses, running or stopped, is ever removed.
# images_above_gb is decimal GB as `docker system df` reports it; 30 GB keeps
# well clear of the 50Gi docker-data cap with room for one large job.
gitea_actions_prune_image: docker.io/library/docker:29.5.2-cli
gitea_actions_prune_interval_seconds: 900
gitea_actions_prune_max_age_minutes: 360
gitea_actions_prune_images_above_gb: 30
gitea_actions_prune_keep_images: >-
{{ gitea_actions_runner_labels
| map('regex_replace', '^[^:]+:docker://', '')
| unique | list }}
# Runner and DinD CPU and memory, for one job at a time. The runner process
# itself is light; DinD holds the job containers, so it gets nearly all of the
# budget. A job that exceeds the DinD memory limit is OOM-killed inside the pod
# and fails with a step error, instead of the node evicting the whole runner.
#
# CPU is sized for the current runner node, alpha-worker-0 (chosen for S3 on
# 2026-11-16 for its 148 GB disk). It has 1 CPU, and other services already
# request about 85% of it (Elasticsearch, Discourse, LocalAI's GPU), so:
# - the DinD request is small enough to schedule there (the pod's three
# containers request 110m in total);
# - the DinD limit stays below one core, so a build can't starve those
# services. Builds are slower as a result.
# On a dedicated 2-CPU node (S3 option 1, #45 or #78), go back to a 500m
# request and a "2" limit.
gitea_actions_runner_resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 500m
memory: 256Mi
gitea_actions_dind_cpu_request: 50m
gitea_actions_dind_cpu_limit: 750m
gitea_actions_dind_memory_request: 2Gi
gitea_actions_dind_memory_limit: 8Gi
# Jobs the runner executes at once. 1 until there's a build host (L1): two
# image builds at once overrun a 2-CPU node's CPU and disk.
gitea_actions_runner_capacity: 1
# Longest a job may run on the runner. Kept below Gitea's
# ENDLESS_TASK_TIMEOUT so the runner, which can say why, fails it first.
# Workflows should still set a shorter `timeout-minutes`.
gitea_actions_runner_job_timeout: 2h
# On SIGTERM the runner waits this long for running jobs, then cancels them and
# reports the result to Gitea. Chart 0.1.2 doesn't expose the pod's
# terminationGracePeriodSeconds, so it stays at Kubernetes' 30s default. This
# plus report_close_timeout (10s) must fit inside those 30s, or the kubelet
# kills the runner before it reports and the job dies silently.
gitea_actions_runner_shutdown_timeout: 15s
gitea_actions_runner_report_close_timeout: 10s
# Per-request timeout when polling Gitea for a job (runner default 5s).
gitea_actions_runner_fetch_timeout: 10s
# Job images, pinned to dated tags from docker.gitea.com/runner-images so a
# job's environment only changes when this list is edited. v26.11.03 has the
# same digests as the floating ubuntu-24.04 and ubuntu-22.04 tags on
# 2026-11-10. With force_pull false these stay cached in DinD between jobs.
gitea_actions_runner_labels:
- "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-24.04-v26.11.03"
- "ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04-v26.11.03"
- "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04-v26.11.03"
# Actions dependency cache (G8). The runner's built-in cache server backs
# actions/cache (v4 and v5 both work; they use its v1 API). Job containers
# reach it at the pod's own IP, which DinD's job networks route to because
# DinD shares the pod's network. Requests are authenticated per job and
# scoped per repository by the runner.
gitea_actions_cache_enabled: true
# Fixed port, so the address is predictable when reading logs or writing
# network rules. Nothing outside the pod needs it.
gitea_actions_cache_port: 8088
# Where cache blobs live inside the runner container.
gitea_actions_cache_dir: /cache
# In the cluster: a PVC on the default storage class (NFS), so the cache
# survives runner restarts. NFS doesn't enforce the size; the runner's own
# expiry keeps it bounded (entries unused for 7 days, and any entry older
# than 30 days, are removed).
gitea_actions_cache_pvc: gitea-actions-cache
gitea_actions_cache_size: 20Gi
# Gitea's [actions] settings (option names checked against Gitea 1.27.0's
# modules/setting/actions.go; defaults in brackets).
# A running task whose runner stops reporting for this long is failed. [10m]
# Shorter, so a job killed with its runner fails within minutes, not quietly.
gitea_actions_zombie_task_timeout: 5m
# A task still running after this long is failed. [3h] Kept above
# gitea_actions_runner_job_timeout so the runner normally fails it first.
gitea_actions_endless_task_timeout: 2h30m
# A job no runner has picked up for this long is cancelled, for example one
# asking for a macOS or Windows runner that doesn't exist here. [24h]
gitea_actions_abandoned_job_timeout: 12h
# Days to keep job logs and uploaded artifacts. [365] and [90]
gitea_actions_log_retention_days: 90
gitea_actions_artifact_retention_days: 30
# Runner on a dedicated Docker host outside the cluster (tasks/actions_host.yaml,
# I3). Applied by its own playbook against that host; the settings above
# (capacity, timeouts, job images, cleanup) apply to it too.
gitea_actions_host_dir: /opt/gitea-runner
gitea_actions_host_instance_url: https://gitea.eom.dev
gitea_actions_host_runner_name: "{{ inventory_hostname }}"
# Inventory host that can run kubectl against the cluster; used once, to get
# a registration token when the runner isn't registered yet.
gitea_actions_host_token_from: alpha-control-plane
# Same images as chart gitea/actions 0.1.2 deploys in the cluster.
gitea_actions_host_runner_image: docker.gitea.com/runner:2.0.1
gitea_actions_host_dind_image: docker.io/docker:29.5.2-dind
# Where the private Docker daemon keeps images, containers and volumes. Docker
# can't cap a bind mount, so the cleanup threshold below keeps it in bounds,
# and the role refuses a first deploy with less free space than min_free_gb.
gitea_actions_host_docker_data: /var/lib/gitea-runner/docker
gitea_actions_host_min_free_gb: 60
gitea_actions_host_prune_images_above_gb: 40
# Job budget. 4 of 6 CPUs and 16 GB suit inspiron-3670 (6 cores, 62 GB),
# leaving room for the host's other services.
gitea_actions_host_dind_cpus: 4
gitea_actions_host_dind_cpu_shares: 512
gitea_actions_host_dind_memory: 16g
# shutdown_timeout + report_close_timeout plus a margin.
gitea_actions_host_stop_grace_period: 40s
# Actions cache directory on the host, mounted at gitea_actions_cache_dir.
gitea_actions_host_cache_dir: "{{ gitea_actions_host_dir }}/cache"