45 lines
2.8 KiB
Markdown
45 lines
2.8 KiB
Markdown
# 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.
|
|
|
|
## Compact by default
|
|
|
|
`make check` prints one line per question — host, toolchain, and for this rig: cluster, memory,
|
|
ports, registry, addons — and adds detail only where something needs attention (`!` lines, the
|
|
"held elsewhere" list when memory is tight, the clashing port). `make check all` prints every fact,
|
|
as the full report did before 2026-09-17. `deps.sh detect all` is the same switch for the host part,
|
|
so the standalone `rigdeps.sh detect` is short too. Changed because the long report buried the few
|
|
lines that mattered.
|