Files
soleprint/rig/docs/notes/check.md

5.1 KiB

ctrl/check.sh

Purpose

Readiness check: is this machine ready to run rig?

It reports and instructs; it never silently fixes anything. Everything it finds is either already fine, or something a human has to decide on.

Runs ctrl/deps.sh host detection in a container when Docker is the only thing installed, or directly when the toolchain is already present. Then adds the checks that need this repo's config: profile sanity, CA trust, port clashes.

memory

A profile on a box that is already full is the most common first failure, and it presents as pods stuck Pending rather than anything that says "memory". The check warns; it never blocks. Whether to try anyway is the user's call.

mb_of

MEMINFO and OVERCOMMIT_FILE exist only so the tight and does-not-fit branches can be exercised against another machine's real numbers; in normal use they are the kernel's own files.

NODE_MB

NODE_MB (what one node costs) comes from load_config (lib/config.sh), where its measurement is recorded. It lives there, not here, because the memory tool and every standalone kit need the same number: a copy of it is how rigmini.sh came to say 2 GB per node long after rig had measured 800 MB.

container_mb

Every running container's working set in MB, tagged with the kind cluster it belongs to ('-' when it is not kind). docker stats reports usage minus page cache, which is what actually competes: cache is handed back under pressure. Counting only kind would hide the usual culprit on a managed workspace, where the memory is held by other containers entirely.

ours_mb / still_mb

Once this environment's own cluster is running, its real footprint is already out of MemAvailable and the per-node estimate stops being relevant. Subtracting the measurement from the estimate would count the same memory twice, and a running cluster that happens to sit under 800 MB would still "need" the gap.

ports: our own cluster

A port held by THIS environment's own cluster is not a clash; it is the thing working. Reporting it as a problem every time the cluster is up would train people to ignore this section, which is the opposite of the point.

The ports are extracted with a second grep rather than tr -d ':->': in tr, ':->' is the character RANGE ':' to '>', which does not contain '-', so the trailing dash survives and nothing ever matches.

Budget first, configuration after (2026-09-23)

make check answers the question people run it for first, in the shape the adapter rig had (the user preferred it): a memory budget with one row per part, the node overhead, the total against what the machine has and has available; then a one-line verdict (fits, ! tight, ! does not fit, with the two opposite fixes told apart); then where things stand and the next command — not created, stopped (with the docker start line), up (with the Tilt and gateway URLs, and whether this environment's Tilt is already running).

Below that, the configuration as it is, raw: the host and toolchain (deps.sh detect), then one key value line each for cluster, context, overlay, profile, nodes, kind config, manifests, ingress, ports (named), registry, addons. ! lines always print; make check all adds every fact (per-port detail, addon list, swap and overcommit notes). deps.sh detect all is the same switch for the host part, so the standalone rigdeps.sh detect is short too.

MEMORY_BUDGET

rig knows what a node costs (NODE_MB), not what a workload does, so the parts come from the overlay's rig.env: MEMORY_BUDGET="name=MB ...", in the order listed; a 0 is left out, and an entry that is not name=MB is a ! line. rig.env is sourced, so an overlay can size a part by its own knob (an airflow sized by the mode the overlay runs it in). When one part outweighs the rest together (and is at least 1 GB), check names it as the first thing to switch off; MEMORY_BUDGET_TIP says how, in the overlay's words. No budget: one ? row says where to add it.

Tilt: ours or another

A Tilt still running after make cluster down holds the Tilt port, and the next make tilt fails with "address already in use" (2026-09-23, the Workspace). check reads the listener with ss -p (our own processes only): a tilt whose working directory is this ctrl/ is this environment's Tilt, reported as running with its URL; another tilt is a ! line with its pid, its folder and the kill that frees the port. Anything else is the ordinary port clash.

overlay and kind config

The rig block names the overlay when one is set (with all: what it provides — rig.env, manifests, kind config, addons, Tiltfile — and where the manifests and kind config resolved to).

Two ! lines belong to overlays. An older ctrl/.env that still pins MANIFESTS_DIR=ctrl/k8s/overlays/dev — rig's examples, before they moved — is reported; load_config ignores it until then. And a kind config without the containerd config_path patch is reported whenever a registry mode needs it: registry.sh writes per-host config into certs.d, containerd only reads it if the cluster was created with that patch, and an overlay's own kind file replaces rig's whole template, so dropping it is easy and fails silently.