Containarium icon indicating copy to clipboard operation
Containarium copied to clipboard

pool join: preserve existing daemon ExecStart flags (don't reset to minimal)

Open hsinatfootprintai opened this issue 5 months ago • 0 comments

Problem

pool join writes a systemd drop-in (renderPoolDropIn) that clears and re-sets the daemon ExecStart to a minimal command:

ExecStart=
ExecStart=/usr/local/bin/containarium daemon --rest --jwt-secret-file <f> --pool <p>   (+ optional --base-domain)

On a host whose daemon already runs with additional flags, those flags are silently dropped on the next daemon restart. Observed on a host being onboarded that ran:

daemon --app-hosting --rest --jwt-secret-file <f> --network-subnet <cidr>

After pool join, both --app-hosting and --network-subnet <cidr> would be gone. That's the worst possible time to change behavior:

  • --network-subnet <cidr> is the bridge the host's pre-existing containers already live on — dropping it makes the daemon fall back to a default subnet and can break those containers' networking.
  • --app-hosting disables local routing/Caddy management.

This is exactly the bring-your-own-compute case (prd/oss/byo-compute-pool-join.md): you join a host that is already running workloads with a customized daemon config, and pool join resets it.

Repro

  1. Run the daemon with any non-minimal ExecStart (extra flags).
  2. containarium pool join --dry-run … → the rendered pool.conf resets ExecStart to the minimal form (the extra flags are absent).
  3. A real join restarts the daemon without them.

--dry-run does surface it (good) — but an operator who skips dry-run is bitten silently.

Fix options

  1. Preserve by default (preferred): read the current effective ExecStart (e.g. systemctl show -p ExecStart) and carry its flags into the drop-in, appending only --pool (+ --base-domain).
  2. Escape hatch: accept a repeatable --daemon-flag / --extra-daemon-args on pool join to pass arbitrary flags through into the drop-in.
  3. At minimum, fail-loud: if pool join detects an existing non-minimal ExecStart it would clobber, refuse (or warn hard) and list the flags that would be dropped, instead of silently resetting.

Preferred = (1) + (3), with (2) as the explicit override.

Refs: internal/cmd/pool_join.go (renderPoolDropIn), prd/oss/byo-compute-pool-join.md.

hsinatfootprintai avatar Jun 16 '26 04:06 hsinatfootprintai