Skip to content

fix(ops): read DB secret ranch-external-db/uri — ranch-api-env doesn't exist - #24

Merged
maksymhryzodub-prog merged 1 commit into
mainfrom
ops/fix-db-secret-name
Aug 7, 2026
Merged

fix(ops): read DB secret ranch-external-db/uri — ranch-api-env doesn't exist#24
maksymhryzodub-prog merged 1 commit into
mainfrom
ops/fix-db-secret-name

Conversation

@maksymhryzodub-prog

Copy link
Copy Markdown
Contributor

Evidence from run 31171799091

The client pod scheduled and pulled its image fine, then looped on:

Error: secret "ranch-api-env" not found

Yet ranch-api is Running — so the live deployment cannot be the one in k8s/platform/api/deployment.yaml (which envFroms ranch-api-env). The live cluster runs the k8s/deploy bootstrap manifests: 30-api.yaml takes DATABASE_URL from secret ranch-external-db, key uri — an external database, which also explains why run 31169336292 found no CNPG cluster.

Fix

  • The client pod now declares both secret candidates as optional: true env sources: ranch-external-db/uri (live today) and ranch-api-env/DATABASE_URL (the k8s/platform world, if the cluster ever migrates to it).
  • The exec step uses whichever is present (${DB_URL_EXTERNAL:-$DB_URL_APIENV}) and fails with a clear message if neither exists.
  • optional: true also means a missing secret can no longer wedge the pod in CreateContainerConfigError — the pod starts, and the error surfaces in the exec step's output instead of a describe dump.

Everything else (guards, \getenv input passing, cleanup) unchanged.

Verification

Next dispatch after merge. The db target: line in the log will show the credential-stripped host of the external DB — worth noting down, since no repo manifest records where prod's database actually is.

🤖 Generated with Claude Code

…t exist

Run 31171799091 failed with 'secret ranch-api-env not found': the live cluster runs the k8s/deploy bootstrap manifests, not k8s/platform — the API's DB connection string lives in secret ranch-external-db, key uri (external database, which also explains why no CNPG cluster exists). Declare both secret candidates as optional env sources and let the exec step use whichever is present, so the workflow survives an eventual migration to the k8s/platform manifests and still fails with a clear message if neither secret exists.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maksymhryzodub-prog
maksymhryzodub-prog merged commit 4709c31 into main Aug 7, 2026
1 check passed
@maksymhryzodub-prog
maksymhryzodub-prog deleted the ops/fix-db-secret-name branch August 7, 2026 11:40
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