feat(pool): `pool join --region auto` — latency-based sentinel selection at join time
Problem
A host joining a multi-region pool must be told which sentinel to dial
(pool join --sentinel <host>:443). Pick the wrong one and every tunneled
connection eats avoidable latency for the life of the host. The operator
usually doesn't know which region is closest to their hardware — and a control
plane that picks one for them is guessing, because latency can only be
measured from the joining host, not from the control plane (the control plane
knows its own RTT to each sentinel, not the host's).
Proposal — measure on the host, at join time
Add containarium pool join --region auto: given a list of candidate sentinels
(region → host:port), the host probes each and self-selects the lowest-latency
one before writing the tunnel unit.
pool join --region auto → probe each candidate (median of N TCP-connects to
the tunnel port, short per-probe timeout)
→ pick lowest median RTT, use it as --sentinel
→ proceed exactly as today; log the chosen region + RTT table
Also expose the measurement standalone:
containarium pool regions --probe— print the region/RTT table without joining.
Candidate list source
MVP: accept repeated candidates on the CLI, e.g. --sentinel <region>=<host>:443
(repeatable) with --region auto selecting among them. The control plane's
"add compute" flow fills these in (paired control-plane issue: return the
candidate sentinel list instead of a single pre-chosen one). A later iteration
can fetch the list directly from the control plane.
Fallbacks (no surprises)
- Exactly one candidate → use it, skip probing.
- A candidate that fails/times out → excluded from selection (logged).
- All candidates fail → error listing what was tried (never silently pick none).
Why / prior art
This is the supply-side analogue of nearest-edge routing (which sends a consumer to its closest edge): here a provider host joins via its closest sentinel. Same "lowest RTT wins" discipline, measured from the right vantage point.
Scope
internal/cmd/pool_join.go—--region auto, candidate parsing, selection.- A small latency-probe helper (pure/unit-testable: feed RTTs → expect winner).
internal/cmd/pool_regions.go(new) —pool regions --probe.- Docs:
prd/oss/byo-compute-pool-join.md.
Pairs with the control-plane issue that returns the candidate sentinel list.
Paired control-plane issue (supplies the candidate sentinel list this consumes): FootprintAI/Containarium-cloud#538.