1.4 KiB
1.4 KiB
Secrets Management Design
Goal: Remove secrets from the Helm chart and provide a kubectl script to bootstrap them out-of-band, compatible with ArgoCD.
Approach: Pre-create with kubectl script (Option A). Helm stops owning the secret; a bootstrap script creates it before the first ArgoCD sync.
Helm chart changes
- Delete
templates/secret.yaml— Helm no longer creates or ownsshorefront-secret - Remove the
secrets:block fromvalues.yamlandvalues-prod.yaml— no secret values in git - The
secretKeyRefreferences inbackend-deployment.yamlandpostgres-deployment.yamlare unchanged; they already referenceshorefront-secretby name
Script: scripts/create-secrets.sh
- Reads
POSTGRES_PASSWORDandJWT_SECRET_KEYfrom environment variables; exits with a clear error if either is unset - Creates the
shorefrontnamespace if it does not exist (safe to run beforehelm install) - Uses
kubectl create secret generic shorefront-secret --dry-run=client -o yaml | kubectl apply -f -for idempotency (safe to re-run for credential rotation) - Prints success/failure
ArgoCD workflow
- Operator runs
scripts/create-secrets.shonce on bootstrap (and again on rotation) - ArgoCD syncs the Helm chart;
shorefront-secretalready exists, pods start normally - ArgoCD does not manage the secret (no
managed-by: Helmannotation), so it never diffs or deletes it