Give write tokens to the api container in the k8s base #157

Merged
svc-agent-writer merged 1 commit from fix/k8s-base-write-tokens into main 2026-11-07 04:51:35 +00:00

Summary

The prepare init container now gives every bearer token to api, not only the read token.

 for f in /secrets/*; do
-  case "${f##*/}" in read-token) continue ;; esac
-  cp "$f" /prepared/sync/
+  case "${f##*/}" in
+    read-token) continue ;;
+    write-token*) cp "$f" /prepared/api/ ;;
+    *) cp "$f" /prepared/sync/ ;;
+  esac
 done

api loads every configured token at start (cli.py, Tokens.load). Under the old base, a config with [[auth.write_tokens]] made api exit with secret=error, because the token file reached only sync. sync never checks bearer tokens, so the write tokens stay out of it, and Source credentials stay out of api.

Evidence

  • Before: test_kustomize_prepare_gives_bearer_tokens_to_api_only runs the real prepare script against fake secrets. On the old base: assert ['read-token'] == ['read-token', 'write-token', 'write-token-agent'] fails.
  • After: it passes. make check: 799 passed, 5 skipped, 0 failed (main: 798). make test-integration on podman: 4 passed.

Merge Danger

Door: two-way

Only a release tag changes a deployment. A consumer picks this up through ?ref= on the next rc.

Blast Radius: k8s

A Secret key named write-token* that a deployment meant for sync would now go to api. No such key exists today.

🤖 Generated with Claude Code

## Summary The `prepare` init container now gives every bearer token to `api`, not only the read token. ```diff for f in /secrets/*; do - case "${f##*/}" in read-token) continue ;; esac - cp "$f" /prepared/sync/ + case "${f##*/}" in + read-token) continue ;; + write-token*) cp "$f" /prepared/api/ ;; + *) cp "$f" /prepared/sync/ ;; + esac done ``` `api` loads every configured token at start (`cli.py`, `Tokens.load`). Under the old base, a config with `[[auth.write_tokens]]` made `api` exit with `secret=error`, because the token file reached only `sync`. `sync` never checks bearer tokens, so the write tokens stay out of it, and Source credentials stay out of `api`. ## Evidence - **Before:** `test_kustomize_prepare_gives_bearer_tokens_to_api_only` runs the real `prepare` script against fake secrets. On the old base: `assert ['read-token'] == ['read-token', 'write-token', 'write-token-agent']` fails. - **After:** it passes. `make check`: 799 passed, 5 skipped, 0 failed (main: 798). `make test-integration` on podman: 4 passed. ## Merge Danger **Door:** two-way Only a release tag changes a deployment. A consumer picks this up through `?ref=` on the next rc. **Blast Radius:** k8s A Secret key named `write-token*` that a deployment meant for `sync` would now go to `api`. No such key exists today. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Give write tokens to the api container in the k8s base
All checks were successful
ci/woodpecker/pr/validation Pipeline was successful
e9311969ee
The prepare init container copied only read-token to api and every other
Secret key to sync. api loads every configured bearer token at start, so a
config with a write token failed with secret=error under the base. Route
read-token and every write-token* key to api only; everything else stays
with sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.