How are secrets stored and delivered? #57
Notifications
Due Date
No due date set.
Depends on
Reference: bobby/hapi#57
Reference in new issue
Block a user
Part of #44
Question
Where do secrets (DB credentials, Bot keys, ntfy tokens, signing keys, Linode API tokens) live, and how do they reach the cluster and the app? Options include SOPS, Sealed Secrets, External Secrets with a backing store (OpenBao/Vault, a password manager), plus rotation.
Input from Which libraries and conventions form the FastAPI app skeleton?: the app reads config via pydantic-settings (
HAPI_-prefixed env vars, or mounted secret files) and fails fast at startup. Secrets must land in one of those two forms.Inputs from How does hAPI connect to its managed database? (#53, ADR-0004): two DB passwords need a home and delivery path:
hapi_app(app and admin CLI) andhapi_migrator(migrate and break-glass only, so ideally not mounted into normal app pods). The DB CA cert (from OpenTofuca_cert) is also needed.akmadminstays only in encrypted OpenTofu state and is pasted in at bootstrap time, never stored in the cluster. Rotation is manual by runbook.Constraints from How do code changes reach the cluster? (#56, ADR-0007):
hapi_appandhapi_migratorDB credentials (the migrate Job uses only the latter)Resolution
Recorded as ADR-0008.
deploy/**/*.sops.yaml, encrypting onlydata/stringData), and decrypted natively by Flux. ESO, Sealed Secrets and hand-created Secrets were rejected.flux-system/sops-ageduring the Flux install, so it's never in OpenTofu state. If it's ever exposed, every value it protected is rotated.secrets_dir, never env vars. The DB CA certificate is a plaintext ConfigMap.hapi-db-appis mounted only into the app Deployment, which also hosts the admin CLI.hapi-db-migratoris mounted only into the migrate Job and a runbook admin pod for bootstrap and break-glass.hapi db bootstrapmakes the roles match.akmadminis still pasted in at run time.hapi db bootstrap(ALTER ROLE) →rollout restart. A few seconds of failed new connections is accepted, and there's no Reloader.