Skip to content

fix(tts-audio): give the synthesis Job the Admin key it needs - #288

Open
sredevopsorgagents wants to merge 2 commits into
mainfrom
fix/tts-audio-job-admin-key
Open

sredevopsorgagents wants to merge 2 commits into
mainfrom
fix/tts-audio-job-admin-key

Conversation

@sredevopsorgagents

Copy link
Copy Markdown
Collaborator

Found by queueing one post end to end after #287 merged.

The bug

Every synthesis Job started, pulled its image, went Running, then died immediately:

{"result":"error","reason":"missing configuration: adminKey"}

The Secret holds admin-api-key, and the job template consumed it with envFrom: secretRef — which turns that key into ADMIN_API_KEY. The worker reads GHOST_ADMIN_API_KEY, so the value never arrived.

The receiver was never affected because its Deployment maps the key explicitly. The Job relied on envFrom and had no mapping at all. Nothing about the manifest looks wrong, the image pull succeeds, and the failure surfaces as a config error from inside the container — it reads like a build problem.

Now mapped explicitly; test.sh asserts the Secret name, key and env var all match.

The trap that made it confusing

While chasing this I hit a second, quiet problem worth documenting: the receiver caches job-template.json in memory for its lifetime (cachedTemplate in k8s.mjs). Applying a ConfigMap fix and immediately re-running produces exactly the old failure — which looks like the fix never worked. It had; it was never loaded. kubectl rollout restart is required, and the README now says so in the Operating section.

I made this mistake myself: applied the fix, retried, saw the identical error, and only then noticed the deployed Job spec still had three env vars.

Verified end to end

One post, from queue to playable audio, on the deployed image:

{"result":"ok","slug":"los-sistemas-de-conocimiento-abierto-tambien-son-infraestructura-critica",
 "locale":"es","sentences":100,"chars":12486,"chunks":34,"tts_ms":973600,
 "bytes":8763598,"duration":730.248,"marker":"written"}
  • 34/34 chunks synthesised, 16 minutes wall time
  • gs://tts-sredevopsorg/audio/6b07a48a.../d7e24de7b382cd88.mp3 → 8.76 MB, 12:10, 96 kbps, 24 kHz mono, audio/mpeg, immutable
  • Marker written into the post's code-injection footer
  • Verified with ffprobe, not just the upload log

deploy/tts-audio/test.sh ✅ (93 worker tests) — the new assertion checked against a regression that removes the mapping.

Not fixed here

AUDIO_BASE_URL points at https://audio.sredevops.org, which returns GCS NoSuchBucket — the hostname maps to a bucket that does not exist. The object itself serves fine from https://storage.googleapis.com/tts-sredevopsorg/... and that URL passes CORS, so this is a DNS/GCS-mapping problem, not a pipeline one. It needs Cloudflare/GCS admin access, which this repo does not have; flagged for a follow-up.

SREDevOpsAgents added 2 commits November 28, 2026 03:53
Every synthesis Job started, pulled its image successfully, went Running, and
then died immediately with `missing configuration: adminKey`.

The Secret holds `admin-api-key`, and the job template consumed it with
`envFrom: secretRef`, which turns that key into `ADMIN_API_KEY`. The worker
reads `GHOST_ADMIN_API_KEY`, so the value never arrived. The receiver pod was
never affected because its Deployment maps the key explicitly — the Job relied
on `envFrom` and had no mapping at all.

Found by actually running one post end to end. Nothing about the manifest looks
wrong, the image pull succeeds, and the failure surfaces as a config error from
inside the container, which reads like a build problem.

Now mapped explicitly, and test.sh asserts the Secret name, key and env var
match. Verified against a regression that removes the mapping.

Related operational trap, documented in the README: the receiver caches
job-template.json in memory for its lifetime (`cachedTemplate` in k8s.mjs), so
editing the tts-job-template ConfigMap has NO effect until the receiver
restarts. Applying a template fix and immediately re-running the backfill
reproduces the old behaviour exactly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant