remove vestigial agent-ports.json tcp web-port map
This commit is contained in:
parent
53f49615fa
commit
ad6b39b425
7 changed files with 33 additions and 209 deletions
|
|
@ -119,27 +119,12 @@ pub async fn sync_agents(hive: &HiveEnv, agents: &[AgentSpec]) -> Result<()> {
|
|||
crate::topology::reconcile(&agent_names, &pending)
|
||||
.with_context(|| format!("reconcile {}", crate::topology::topology_path().display()))?;
|
||||
|
||||
// Refresh /var/lib/hyperhive/run/agent-ports.json so the hive-gateway
|
||||
// nginx sees the new agent set. The file is the single source of
|
||||
// truth for which agents the gateway proxies to, since the
|
||||
// gateway container lives in system config and can't be rebuilt
|
||||
// from meta-flake events. Atomic write (tmp + rename) so a
|
||||
// partial write never trips the gateway's read.
|
||||
if let Err(e) = crate::agent_ports::write(&agent_names) {
|
||||
// Best-effort: a failed write doesn't block the meta-flake
|
||||
// regen + container ops that follow. The gateway falls back
|
||||
// to whatever map is currently on disk (or an empty map on
|
||||
// first boot, meaning no per-agent routing yet).
|
||||
tracing::warn!(error = ?e, "agent_ports::write failed (non-fatal)");
|
||||
}
|
||||
|
||||
// Refresh /var/lib/hyperhive/run/agent-sockets.json — sibling to the
|
||||
// ports map, drives the gateway's unix-socket upstreams once
|
||||
// agents opt in to `HIVE_WEB_SOCKET`. Coexists with the TCP-port
|
||||
// map during the transition: the gateway picks the socket
|
||||
// upstream when one exists, falls back to the TCP port otherwise.
|
||||
// Same best-effort + non-fatal shape. See
|
||||
// `docs/gateway.md::Per-agent unix-socket upstream`.
|
||||
// Refresh /var/lib/hyperhive/run/agent-sockets.json — drives the
|
||||
// gateway's unix-socket upstreams. Every agent binds a unix socket
|
||||
// (`HIVE_WEB_SOCKET`); the gateway routes via this map, falling back
|
||||
// to a computed TCP loopback port (`lifecycle::agent_web_port`) only
|
||||
// while an agent's socket marker is absent. Best-effort + non-fatal.
|
||||
// See `docs/gateway.md::Per-agent unix-socket upstream`.
|
||||
if let Err(e) = crate::agent_sockets::write(&agent_names) {
|
||||
tracing::warn!(error = ?e, "agent_sockets::write failed (non-fatal)");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue