You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(chart): read PostgreSQL connection strings from an existing Secret - #887
Closes#872. Part of #867. This PR is independent of the API audit and HA changes.
Merge order
This PR targets the upstream fix/native-api-credential-boundary branch because #886 and this change both edit the API Deployment and its Kind install fixture. Merge #886 into master first, then retarget this PR to master and confirm the remaining diff contains only the PostgreSQL Secret change. The Closes #872 declaration takes effect when this PR targets the default branch.
Configuration
Set api.db.existingSecret to an existing Secret in the release namespace and optionally set api.db.secretKey (default dsn). The API and exec subcommands such as bootstrap-admin inherit the required Secret reference. In this mode the Deployment omits the DSN argument. Existing literal and default SQLite configurations keep their prior behavior.
The installation guide covers migration with sanitized Helm values, credential rotation, historical Helm revisions and restarting the API after a Secret update.
Verification
Rendered the PostgreSQL chart locally with a custom Secret name/key and the default SQLite chart. Confirmed the resulting environment and argument paths.
The existing Kind PostgreSQL workflow now installs with only a Secret reference, exercises bootstrap/login and a populated Helm upgrade, inspects workload metadata, logs and release revisions for the disposable password, and tests missing Secret and key behavior on disposable pods.
On b80d0ab8, the populated PostgreSQL upgrade passed in 92.97 s. The same Kind job checked the Secret selector, Helm history and logs, and verified that an invalid Secret name or key blocks Pod startup. Full CI passed with 51 successful jobs and 12 skips. PostgreSQL Secret test · CI report.
Summary by CodeRabbit
New Features
The API and bootstrap-admin can now read the database connection string from an existing Kubernetes Secret. Configure the Secret name and key; the key defaults to dsn.
Documentation
Added setup and migration guidance for Secret-based database configuration, including the behavior when the Secret or key is missing and how to apply Secret changes.
No actionable comments were generated in the recent review.
Walkthrough
The chart can configure the API database DSN from an existing Kubernetes Secret instead of a literal value. The PostgreSQL Kind profile uses that setting, and a new check validates the deployment configuration and scans for a fixture canary.
Changes
Secret-backed PostgreSQL DSN
Layer / File(s)
Summary
Chart configuration and migration guidance charts/gameplane/values.yaml, charts/gameplane/templates/api.yaml, docs/install.md, changelog/unreleased/887-postgres-secret.md
The chart omits --db-dsn when api.db.existingSecret is set and sources GAMEPLANE_DB_DSN from the configured Secret key, defaulting to dsn. The values reference and installation guidance describe Secret precedence, missing Secret or key behavior, and migration considerations. The changelog describes Secret-based DSN use by the API and bootstrap-admin.
Kind PostgreSQL fixture and validation deploy/kind/e2e.sh, deploy/kind/check-postgres-secret.sh, .github/workflows/ci.yaml
The PostgreSQL profile selects gameplane-postgres without reading its DSN into Helm values. The new check validates the API argument and Secret reference, scans Helm revisions and API resources for the canary, and probes missing Secret names and keys. CI runs the check after the PostgreSQL recovery test and removes a command that printed API arguments.
This change lets the chart read the PostgreSQL connection string from an existing Secret and keeps the literal DSN and SQLite behavior unchanged. No merge-blocking risk was found in the supplied review context.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "fix(chart): read PostgreSQL connection strings from an existing Secret" matches the main change. The PR adds api.db.existingSecret and api.db.secretKey to the Helm chart. The API Deployment…
Linked Issues check
Direct linked issue #872 (current, open) requires Secret-backed PostgreSQL configuration for the API and bootstrap. Evidence from the reviewed head (merge base 5e44edf, head 05342f0):
- Configurabl…
Out of Scope Changes check
Changes introduced by this PR and their links to #872:
- charts/gameplane/templates/api.yaml and charts/gameplane/values.yaml: Secret-mode args and env wiring, and the values documentation. Direc…
Full details: Title check
Explanation
The title "fix(chart): read PostgreSQL connection strings from an existing Secret" matches the main change. The PR adds api.db.existingSecret and api.db.secretKey to the Helm chart. The API Deployment omits --db-dsn and reads GAMEPLANE_DB_DSN from the named Secret. The title names the chart scope, the PostgreSQL target, and the Secret-backed behavior. It is concise and specific.
Full details: Linked Issues check
Explanation
Direct linked issue #872 (current, open) requires Secret-backed PostgreSQL configuration for the API and bootstrap. Evidence from the reviewed head (merge base 5e44edf, head 05342f0):
Configurable existing Secret name and key [#872]: api.db.existingSecret and api.db.secretKey (default dsn) are added in charts/gameplane/values.yaml and read in charts/gameplane/templates/api.yaml. Confirmed by the reviewed template text.
Omit the literal DSN flag in Secret mode [#872]: the api.yaml Deployment args render --db-dsn only when api.db.existingSecret is unset. Confirmed by the reviewed template text.
Secret reference for GAMEPLANE_DB_DSN on applicable paths [#872]: the change summary states that the Deployment env value comes from the named Secret and key. deploy/kind/check-postgres-secret.sh asserts the exact secretKeyRef selector. The env block of api.yaml was truncated in my read, so the env section is supported by the attested summary and the script assertion, not by a full direct read. The PR description states that bootstrap-admin exec subcommands inherit the reference.
Precedence: Secret mode replaces the literal DSN in args and env. Literal and default SQLite configurations keep their prior behavior, because --db-dsn still renders when existingSecret is unset.
Migration, rotation, Helm revision persistence and API restart [#872]: docs/install.md (+24 lines per summary) covers these topics. I did not read the document text directly.
Acceptance checks [#872]: deploy/kind/check-postgres-secret.sh scans every Helm revision's values and manifest, Deployment metadata, pods and logs for the canary e2e-postgres-password. It also creates disposable pods with the Secret name or key changed and waits for CreateContainerConfigError. deploy/kind/e2e.sh selects the gameplane-postgres Secret, and .github/workflows/ci.yaml runs the check after the populated upgrade.
Qualification runs: the PR description links CI and PostgreSQL test runs. I did not verify these run results.
No coding requirement of #872 is unmet by the reviewed evidence. The Helm and Kind checks were not executed by this assessment.
Full details: Out of Scope Changes check
Explanation
Changes introduced by this PR and their links to #872:
charts/gameplane/templates/api.yaml and charts/gameplane/values.yaml: Secret-mode args and env wiring, and the values documentation. Directly implements #872.
deploy/kind/check-postgres-secret.sh (new) and deploy/kind/e2e.sh: Kind verification of the Secret reference, canary scanning, and missing Secret/key behavior. Supports the #872 acceptance criteria.
.github/workflows/ci.yaml: removes an earlier argument print and adds the check-script step. Supports the Kind verification.
docs/install.md: migration, rotation, Helm revision and restart guidance required by #872.
changelog/unreleased/887-postgres-secret.md: changelog entry for the new configuration. Documents the change. Not a code change.
No unrelated changes were identified. The PR description states that this PR is independent of the API audit and HA changes. Stack review evidence is unavailable, so this assessment covers only the changes in the current PR.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 5e44edf and 05342f0.
Files selected for processing: 7
.github/workflows/ci.yaml
changelog/unreleased/887-postgres-secret.md
charts/gameplane/templates/api.yaml
charts/gameplane/values.yaml
deploy/kind/check-postgres-secret.sh
deploy/kind/e2e.sh
docs/install.md
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
CRITICAL: Every workflow MUST follow hardened-CI practices: All external actions MUST be pinned to a full 40-hex commit SHA (not a tag or branch) Each action SHA pin MUST include an inline version comment for human readability Workflows MUS...
Source excerpt: A feature's spec folder MUST be renamed from `specs/-/` to `specs/done_-/` once that feature is complete — meaning every task in its `tasks.md` is checked off or explicitly withdrawn, and the feature's...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #872. Part of #867. This PR is independent of the API audit and HA changes.
Merge order
This PR targets the upstream
fix/native-api-credential-boundarybranch because #886 and this change both edit the API Deployment and its Kind install fixture. Merge #886 intomasterfirst, then retarget this PR tomasterand confirm the remaining diff contains only the PostgreSQL Secret change. TheCloses #872declaration takes effect when this PR targets the default branch.Configuration
Set
api.db.existingSecretto an existing Secret in the release namespace and optionally setapi.db.secretKey(defaultdsn). The API and exec subcommands such asbootstrap-admininherit the required Secret reference. In this mode the Deployment omits the DSN argument. Existing literal and default SQLite configurations keep their prior behavior.The installation guide covers migration with sanitized Helm values, credential rotation, historical Helm revisions and restarting the API after a Secret update.
Verification
b80d0ab8, the populated PostgreSQL upgrade passed in 92.97 s. The same Kind job checked the Secret selector, Helm history and logs, and verified that an invalid Secret name or key blocks Pod startup. Full CI passed with 51 successful jobs and 12 skips. PostgreSQL Secret test · CI report.Summary by CodeRabbit
bootstrap-admincan now read the database connection string from an existing Kubernetes Secret. Configure the Secret name and key; the key defaults todsn.