feat: add seed credential env vars to k8s deployment #28
No reviewers
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
forgejo_admin/pal-e-api!28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "28-seed-credentials-k8s"
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?
Summary
PALDOCS_SEED_EMAILandPALDOCS_SEED_PASSWORDenv vars to k8s deploymentpal-e-docs-secretsk8s secret (already created with all 3 keys)Changes
k8s/deployment.yaml: Add two new env vars referencingpal-e-docs-secretssecret keysseed-emailandseed-password. Remove stale TODO comment.Test Plan
CreateContainerConfigError/browse/loginwith seeded credentialsReview Checklist
Related Notes
issue-seed-credentials-k8s— the issue this PR addressesplan-2026-02-25-private-notes-auth— Phase 1 deployment follow-upQA Review: PASS ✓
All checks passed. This PR is clean and ready to merge.
Findings
Configuration & Secrets:
pal-e-docs-secretsexists inpal-e-docsnamespace with all 3 expected keys:secret-key,seed-email,seed-passwordCode Integration:
src/pal_e_docs/config.pydefinesseed_emailandseed_passwordsettings withPALDOCS_prefix (matches env var names)src/pal_e_docs/main.pyimplements_seed_user()function that consumes these settings on app startupif not settings.seed_email or not settings.seed_password: return)YAML & Deployment:
valueFrom.secretKeyRefpattern (no hardcoded secrets)No Issues Found
PR #28 Review -- Seed Credentials + Litestream Sidecar
Overall Assessment: APPROVED (post-merge review)
This is a clean, well-structured PR that adds two distinct but related features: seed credential env vars for the auth system, and Litestream continuous backup to MinIO. Both are implemented correctly following k8s best practices.
1. k8s/deployment.yaml -- Litestream Pattern
Init container (litestream-restore): Correct. The
-if-db-not-existsflag is critical -- it ensures a fresh deployment restores from backup, but an existing PVC with a live database is left alone. The config path, data path, and volume mounts are all consistent.Sidecar (litestream-replicate): Correct. Runs alongside the main container with shared
/datavolume. Thereplicatecommand will continuously stream WAL changes to MinIO.Volume sharing: Both Litestream containers and the main app container all mount the
dataPVC at/data, and both Litestream containers mount the configmap at/etc/litestream. This is exactly right.Resources: Reasonable and conservative. Init container gets 32Mi request / 64Mi limit, sidecar gets 32Mi / 64Mi, main app gets 32Mi / 128Mi. CPU requests are 10m across the board. No CPU limits set, which is the correct modern practice (CPU limits cause throttling).
Strategy and replicas:
replicas: 1withstrategy: Recreate-- essential for SQLite/Litestream. No two pods should ever run concurrently against the same PVC. Already present from before this PR.2. k8s/litestream-configmap.yaml -- Litestream Config
Env var substitution: Correct. Litestream natively supports
${ENV_VAR}substitution in its YAML config at runtime. The four env vars (LITESTREAM_BUCKET,LITESTREAM_ENDPOINT,LITESTREAM_ACCESS_KEY,LITESTREAM_SECRET_KEY) are injected viaenvFromfrom thelitestream-credssecret.MinIO compatibility flags:
force-path-style: true-- required for MinIO (not a virtual-hosted-style S3).skip-verify: true-- correct for internal cluster traffic tominio.minio.svc.cluster.local.Replica path:
pal-e-docs/-- clean, identifies the service within the shared bucket.DB path:
/data/pal-e-docs.db-- matchesPALDOCS_DATABASE_PATHenv var in the main container.3. k8s/kustomization.yaml
New resource
litestream-configmap.yamlis listed. Correct.4. Seed Credential Env Vars
PALDOCS_SEED_EMAILandPALDOCS_SEED_PASSWORDboth referencepal-e-docs-secretswith keysseed-emailandseed-password. Verified against the appconfig.pywhich expectsPALDOCS_prefix settingsseed_emailandseed_password(bothstr | None). The env var names map correctly via pydantic-settings.The stale TODO comment was correctly removed.
5. Minor Observations (non-blocking)
Litestream image tag
0.3: Litestream is now at 0.5.x. The0.3tag still works and is battle-tested, so this is not a blocker, but worth noting for a future upgrade. The0.3tag is a major-version float which will pull the latest 0.3.x patch.No
readOnlyon configmap mount: The/etc/litestreammount could usereadOnly: truesince Litestream only reads the config. Not a blocker -- just a hardening nit.PR title mentions only seed credentials but the branch also contains the Litestream commit. The PR title should arguably reflect both changes. Minor -- the diff speaks for itself.
Verdict: Ship it. The Litestream pattern is textbook (init restore + sidecar replicate), volume sharing is correct, env var plumbing matches the app config, and the configmap properly uses Litestream native env substitution for MinIO credentials. No secrets in code.