diff --git a/docs/monitoring-dashboards.md b/docs/monitoring-dashboards.md index 3cd4762..efa87d7 100644 --- a/docs/monitoring-dashboards.md +++ b/docs/monitoring-dashboards.md @@ -215,6 +215,7 @@ deploying another exporter. `forgejo-runner-prune-*` CronJob pods, which are `Completed` and therefore permanently "not Ready" — that turned a not-Ready stat from 0 into 3 until the selector was narrowed to the three Deployment pod prefixes. +- **Two namespaces on one board: runner pods live in `ci-runners`, the queue lives in the `forgejo` database.** The CI capsule moved to `ci-runners` (so `forgejo` can enforce PSA `baseline` — see `docs/pod-security.md`), so every pod/PVC/Deployment target is built from `build.py`'s single `CI_RUNNERS_NS = 'ci-runners'` constant. The `cnpg_actions_*` / `cnpg_*` targets keep `namespace="forgejo"`: that label comes from the scrape of the CNPG **database** cluster, not from the runners. Never blanket-replace the namespace in either direction — a runner-pod query against `forgejo` is silently empty, and a DB query against `ci-runners` is too. Moving the capsule again should be a one-line `CI_RUNNERS_NS` change plus a regenerate. - **CNPG custom-query metrics carry `namespace`/`pod` from the scrape, not the exporter's `cluster` label.** `cnpg_collector_*` has `cluster`; the `cnpg_actions_*` and `cnpg_pg_stat_*` families do not. Filter those by diff --git a/monitoring/controllers/home/dashboards/build.py b/monitoring/controllers/home/dashboards/build.py index 23eadd0..2441817 100644 --- a/monitoring/controllers/home/dashboards/build.py +++ b/monitoring/controllers/home/dashboards/build.py @@ -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) \ No newline at end of file