Skip to main content
← Back to list
01Issue
FeatureOpenSwamp CLIPublic
AssigneesNone

Relationships

#1862 feat(worker): --server-token-file (and --token-file) to read secrets from a mount without env-var round-trip

Opened by stack72 · 8/27/2026

Ask

Add --server-token-file <path> (and matching --token-file <path>) to swamp worker connect, mirroring how swamp serve already accepts --cert-file / --key-file for TLS material.

Why

Kubernetes and other orchestrators mount Secrets as read-only files on tmpfs. The idiomatic secret path is:

  1. Cluster projects the Secret onto `/tokens/server-token`.
  2. Process reads the file directly.
  3. Value never enters the process env or argv.

Today the shape of the CLI forces one of:

  • `--server-token "$(cat /tokens/server-token)"` — value lands on argv (`/proc//cmdline`).
  • `SWAMP_SERVER_TOKEN="$(cat /tokens/server-token)" swamp worker connect ...` — value lands in `/proc//environ`.

Both are strictly worse than reading the mounted file. `/proc//environ` is process-owner-only in a PSA-restricted container, so it is not a break in that setup, but the pattern is uneven across tools and forces a shell shim in every chart. Same argument for the pool enrollment token `--token`.

Reference chart that has to work around this: hivemq/asdlc `charts/swamp/templates/worker-statefulset.yaml` — the pod mounts `worker.tokenSecret` at `/tokens/`, the shell reads the file, exports `SWAMP_SERVER_TOKEN`, then `exec swamp worker connect`. A `--server-token-file` flag would collapse that to a direct arg.

Shape

Match the existing `--cert-file` / `--key-file` pattern:

  • `--token-file ` (env: `SWAMP_WORKER_TOKEN_FILE`) — mutually exclusive with `--token` and `SWAMP_WORKER_TOKEN`.
  • `--server-token-file ` (env: `SWAMP_SERVER_TOKEN_FILE`) — mutually exclusive with `--server-token` and `SWAMP_SERVER_TOKEN`.

Trim any trailing newline (a `kubectl create secret --from-file` output almost always has one).

Not asked for

  • Vault or 1Password integration in the CLI.
  • Config-file loading for these values.
  • Deprecating the existing value/env options.

The file variants are additive.


Automoved by swampadmin from https://github.com/swamp-club/swamp/issues/2286

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

8/27/2026, 1:13:38 PM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.