[CRITICAL] Migration 044 streamlit_ro_role requires WESTSIDE_STREAMLIT_RO_PASSWORD env var that's not in pod env — basketball-api still CrashLoopBackOff #449
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/basketball-api#449
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Bug
Lineage
Discovered 2026-04-11 immediately after PR #444 merged. The 041 collision fix unblocked alembic enough to run migration 044, which then crashed because the original PR #5/#435 introduced the migration without injecting the env var it requires. Related: #441 (040 fix), #443 (041 fix), PR #5/#435 (origin).
Repo
forgejo_admin/pal-e-deployments(the actual fix lives here, not basketball-api — the migration code is correct, only the deploy environment is wrong)What Broke
Migration
044_add_westside_streamlit_ro_role.pyline 44 raisesRuntimeErrorbecauseWESTSIDE_STREAMLIT_RO_PASSWORDis not in the basketball-api pod's environment.basketball-api-secrets currently holds 4 keys (postgres-password, stripe-api-key, stripe-webhook-secret, keycloak-admin-password) but NOT WESTSIDE_STREAMLIT_RO_PASSWORD. The basketball-api deployment-patch.yaml does NOT mount this env var. Result: every basketball-api pod startup since the original PR #5/#435 merge has failed at migration 044, but the failure was masked for 20+ hours by a separate dual-revision-041 collision (alembic crashed BEFORE reaching the body of either 041) and by RollingUpdate maxUnavailable=0 keeping the old pod alive.
Repro Steps
harbor.tail5b443a.ts.net/basketball-api/api:1bd8c301bae18d9008deeabc3a85e77b2e2e267falembic upgrade headkubectl -n basketball-api logs basketball-api-585cbf95d6-rcmrb --tail=30→ shows the RuntimeError abovekubectl -n basketball-api get deploy basketball-api -o jsonpath='{.spec.template.spec.containers[0].env}' | grep -i streamlit→ empty (env var not defined)kubectl -n basketball-api get secret basketball-api-secrets -o jsonpath='{.data}' | grep -i streamlit→ empty (key not in secret)ls ~/secrets/pal-e-services/westside-streamlit.env→ exists on host (mode 0600, ldraney owner) — this is the source of truth for the passwordExpected Behavior
basketball-api pod starts cleanly.
alembic upgrade headreaches revision 044, creates thewestside_streamlit_ropostgres role using the password from a Kubernetes Secret, advances to 044 (will subsequently advance to 043 jersey_public_orders if there's a higher revision — order depends on the chain).Environment
basketball-apibasketball-api-585cbf95d6-rcmrbrunning image1bd8c301bae18d9008deeabc3a85e77b2e2e267f(post PR #444 merge)basketball-api-5c4b9bcc-vvfsx(alembic_version=042, no jersey_public_orders table, no westside_streamlit_ro role)Synced / Progressing(cannot complete rollout)~/secrets/pal-e-services/westside-streamlit.envpal-e-deployments/overlays/basketball-api/prod/harbor-creds.enc.yamlharbor-creds.enc.yamlas a resourceFile Targets
Files to create:
pal-e-deployments/overlays/basketball-api/prod/westside-streamlit-secret.enc.yaml— new SOPS-encrypted Kubernetes Secret namedwestside-streamlit-secretcontaining keyWESTSIDE_STREAMLIT_RO_PASSWORDsourced from~/secrets/pal-e-services/westside-streamlit.env. Encrypt with the same SOPS recipient/age key used byharbor-creds.enc.yamlin this overlay (read that file's metadata to learn the recipient).Files to modify:
pal-e-deployments/overlays/basketball-api/prod/kustomization.yaml— addwestside-streamlit-secret.enc.yamlto theresources:list (next toharbor-creds.enc.yaml)pal-e-deployments/overlays/basketball-api/prod/deployment-patch.yaml— append a new env var to theappcontainer'senv:list:Files the agent should NOT touch:
basketball-apirepo entirely — the migration is correct, no Python changes neededbasketball-api-secretsk8s Secret — externally managed, do not modifyharbor-creds.enc.yamlfile itself (read for SOPS recipient pattern only)Acceptance Criteria
westside-streamlit-secret.enc.yamlexists inpal-e-deployments/overlays/basketball-api/prod/harbor-creds.enc.yamlmetadata.name = westside-streamlit-secretand a single keyWESTSIDE_STREAMLIT_RO_PASSWORDwhose value matches the password in~/secrets/pal-e-services/westside-streamlit.envkustomization.yamllists the new file inresources:deployment-patch.yamlincludes the new env var pointing atwestside-streamlit-secretkustomize build pal-e-deployments/overlays/basketball-api/prod/ | kubectl apply --dry-run=client -f -succeedskubectl -n basketball-api get secret westside-streamlit-secretreturns the secretkubectl -n basketball-api get deploy basketball-api -o jsonpath='{.spec.template.spec.containers[0].env[*].name}'includesWESTSIDE_STREAMLIT_RO_PASSWORDRunning 1/1status (no CrashLoopBackOff)kubectl -n basketball-api exec postgres-9b5b87b5-5nccx -- psql -tc "SELECT 1 FROM pg_roles WHERE rolname='westside_streamlit_ro';"returns 1alembic_versiontable reaches at least 044 (and 043 jersey_public_orders if the chain order resolves that way)Synced / HealthyTest Expectations
sops -d westside-streamlit-secret.enc.yamldecrypts and shows valid YAMLkustomize buildsucceedsConstraints
harbor-creds.enc.yamlrecipient — find bysops --decrypt harbor-creds.enc.yaml > /dev/nullor by reading the SOPS metadata block at the bottom of that filewestside-streamlit-secret) — do not append to basketball-api-secretsRelated
pal-e-platform— project tracking (this is platform-level deploy infra)westside-basketball— affected product (jersey System B production rollout still blocked by this)forgejo_admin/basketball-api#441— sister bug 040 collision (fixed by PR #442)forgejo_admin/basketball-api#443— sister bug 041 collision (fixed by PR #444)feedback_funnel_requires_auth.md— adjacent secrets-management themeScope Review: APPROVED
Review note:
review-967-2026-04-10Emergency hot-fix scope is tight and correct. All file targets verified on disk, SOPS age recipient derivable from
harbor-creds.enc.yaml, story:WS-S31 verified on project-westside-basketball,WESTSIDE_STREAMLIT_RO_PASSWORDconfirmed absent fromdeployment-patch.yaml, password source file exists at~/secrets/pal-e-services/westside-streamlit.env. 1 new file + 2 modified files, single-directory, well under the 5-minute rule. No decomposition needed. Ready for dev dispatch — advance backlog → todo → next_up.