fix(secrets): injector wrapper must replace the entrypoint #119

Merged
michal merged 1 commits from fix/injector-entrypoint into main 2026-08-21 00:28:34 +00:00
Owner

Pod crashlooped with cannot open /vault/secrets/... because the wrapper landed in k8s args, so the runner image ENTRYPOINT still ran: npx -y /bin/sh -c .... The agent had rendered the file correctly; nothing sourced it.

Adds ContainerSpec.entrypoint (maps to k8s command, replacing the image entrypoint) and folds npx -y / uvx into the wrapped argv. Two regression tests.

Pod crashlooped with `cannot open /vault/secrets/...` because the wrapper landed in k8s `args`, so the runner image ENTRYPOINT still ran: `npx -y /bin/sh -c ...`. The agent had rendered the file correctly; nothing sourced it. Adds ContainerSpec.entrypoint (maps to k8s `command`, replacing the image entrypoint) and folds `npx -y` / `uvx` into the wrapped argv. Two regression tests.
michal added 1 commit 2026-08-21 00:28:33 +00:00
fix(secrets): the injector wrapper must replace the entrypoint, not extend it
Some checks failed
CI/CD / typecheck (pull_request) Successful in 1m23s
CI/CD / lint (pull_request) Successful in 2m35s
CI/CD / test (pull_request) Successful in 1m27s
CI/CD / build (pull_request) Successful in 2m24s
CI/CD / smoke (pull_request) Failing after 3m5s
CI/CD / publish (pull_request) Has been skipped
ec35e1cc36
Caught migrating a real server: the pod crashlooped with
`.: cannot open /vault/secrets/grafana-creds`, and the reason was in the
generated spec:

  args: ["/bin/sh","-c",". /vault/secrets/grafana-creds; exec \"$0\" \"$@\"",
         "@leval/mcp-grafana"]

mcpd deliberately maps ContainerSpec.command -> k8s `args` so a package
server keeps its runner image's ENTRYPOINT (`npx -y`, `uvx`). Putting the
sourcing wrapper there meant the pod actually ran
`npx -y /bin/sh -c '...'` — npx trying to resolve a package called
/bin/sh. The agent had rendered the file correctly; nothing ever sourced it.

Adds `ContainerSpec.entrypoint`, which maps to k8s `command` and so
REPLACES the image entrypoint, and has wrapCommand fold that entrypoint
into the argv it returns (`npx -y` / `uvx` for package servers, the
server's own `entrypoint` field for dockerImage servers — already required
at validation for exactly this reason).

Two tests pin it: a wrapped server emits `command` and no `args`; an
unwrapped one still emits `args` and no `command`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vybEitX4FykeMatKe5Xki
michal merged commit f25616f720 into main 2026-08-21 00:28:34 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: michal/mcpctl#119