refactor(monitoring): one CI_RUNNERS_NS constant for the forgejo-runners pod panels

The runner pod/PVC/Deployment targets on the forgejo-runners board belong to
namespace ci-runners (the CI capsule moved there so forgejo can enforce PSA
baseline), while the cnpg_actions_* queue/jobs targets belong to the forgejo
*database*. aec63c4 fixed the namespace by hand in eight places; this replaces
those literals with one CI_RUNNERS_NS constant fed into RUN, the replicas_ready
stat and the dind PVC stat, and documents the two-namespace split in
docs/monitoring-dashboards.md so the next move is a one-line change.

Regenerated with build.py: forgejo-runners.yaml is byte-identical to the
committed file (no behaviour change, no other board touched). Note the name is
CI_RUNNERS_NS, not RUNNER_NS - RUNNER_NS is already the Loki selector
constant in this script.

validate_panels.py against Prometheus: 55/55 targets OK, 0 empty. On this
board: Runner pods Ready=3 (1 series), restarts 6 series over the three pods,
CPU/mem/net 3 series each, dind PVC 20Gi.
This commit is contained in:
Lance Walters 2026-11-27 01:36:05 -05:00
commit 3dae4d06a9
2 changed files with 10 additions and 4 deletions

View file

@ -196,16 +196,21 @@ def loki_runner_ns_variable():
# ---------------------------------------------------------------- runners -----
# The CI capsule moved out of `forgejo` (card t_2bbe34a8, PSA baseline there) into
# `ci-runners`; every pod/PVC/Deployment target below uses this namespace. The
# `cnpg_actions_*` queue/jobs targets keep namespace="forgejo" — that is the
# Forgejo *database*, not the runners. Do not conflate the two.
CI_RUNNERS_NS = 'ci-runners'
# Only the three runner Deployments' pods. `forgejo-runner-.*` also matches the
# `forgejo-runner-prune-*` CronJob pods, which are Completed and permanently
# "not Ready" — that turned a 0 into a 3 on the not-Ready stat.
RUN = 'namespace="ci-runners",pod=~"forgejo-runner-(amd64|arm64|deploy-arm64)-.*"'
RUN = 'namespace="%s",pod=~"forgejo-runner-(amd64|arm64|deploy-arm64)-.*"' % CI_RUNNERS_NS
SIRIUSSEC_FS = 'instance="10.10.0.2:9100",mountpoint="/"'
RPI_FS = 'instance="10.10.0.1:9100",mountpoint="/"'
runners = [
row("Runners & queue", 0),
stat("Runner pods Ready", [target('sum(kube_deployment_status_replicas_ready{namespace="ci-runners",deployment=~"forgejo-runner-.*"}) or vector(0)')],
stat("Runner pods Ready", [target('sum(kube_deployment_status_replicas_ready{namespace="%s",deployment=~"forgejo-runner-.*"}) or vector(0)' % CI_RUNNERS_NS)],
{"h": 5, "w": 4, "x": 0, "y": 1}, desc="replicas_ready summed across the three runner Deployments. Expected 3.",
thresholds=[{"color": "red", "value": None}, {"color": "yellow", "value": 2}, {"color": "green", "value": 3}]),
stat("Runner pods not Ready", [target('sum(kube_pod_status_ready{%s,condition="false"} == 1) or vector(0)' % RUN)],
@ -257,7 +262,7 @@ runners = [
ts("Runner pod network I/O", [target('sum by (pod) (rate(container_network_receive_bytes_total{%s}[5m]))' % RUN, "{{pod}} in"),
target('sum by (pod) (rate(container_network_transmit_bytes_total{%s}[5m]))' % RUN, "{{pod}} out", ref="B")],
{"h": 8, "w": 8, "x": 0, "y": 25}, unit="Bps", desc="Image pulls and artifact traffic through the pod interface."),
stat("dind PVC nominal size", [target('max(kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace="ci-runners",persistentvolumeclaim="forgejo-runner-amd64"})')],
stat("dind PVC nominal size", [target('max(kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace="%s",persistentvolumeclaim="forgejo-runner-amd64"})' % CI_RUNNERS_NS)],
{"h": 8, "w": 4, "x": 8, "y": 25}, unit="bytes",
desc="Requested size of the forgejo-runner-amd64 PVC (docker data-root + named CI volumes). This is the ceiling, not the usage — see the note on this row."),
stat("siriussec root fs used", [target('100 * (1 - node_filesystem_avail_bytes{%s} / node_filesystem_size_bytes{%s})' % (SIRIUSSEC_FS, SIRIUSSEC_FS))],
@ -587,4 +592,4 @@ for uid, panels in PANELS.items():
f.write("data:\n %s.json: |\n" % uid)
for line in doc["data"][uid + ".json"].rstrip("\n").split("\n"):
f.write(" " + line + "\n")
print("wrote", path)
print("wrote", path)