Skip to content

docs(postgres): name the trust anchor as the tenant actually sees it - #3463

Merged
myasnikovdaniil merged 2 commits into
mainfrom
fix/tenant-ca-doc-accuracy
Aug 17, 2026
Merged

docs(postgres): name the trust anchor as the tenant actually sees it#3463
myasnikovdaniil merged 2 commits into
mainfrom
fix/tenant-ca-doc-accuracy

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Two documentation defects that both landed with the CA trust-anchor work in #3407.

The Postgres README told a tenant to fetch <release>.tenant-ca. The release name carries the postgres- prefix the application definition applies, so the object is postgres-<name>.tenant-ca, and the postgres chainsaw test shows exactly that for a resource named test. A tenant following the README got NotFound. I confirmed the real name on a live cluster while converting another engine onto the same contract.

The second is a comment in the controller and one in its RBAC chart, both promising a companion ValidatingAdmissionPolicy that pins sentinel writes to helm-controller. No such policy ships. It was proposed in #3410 and rejected: authorizing by request.userInfo.username duplicates RBAC in a more brittle form, and the RBAC boundary already holds because no tenant role has any verb on internal.cozystack.io. The comments now say that instead of pointing at a guard that does not exist.

Downstream repositories

Documentation only, no API or chart behaviour changes. cozystack/website regenerates the Postgres reference page from this README on the next stable tag, so no manual follow-up is needed there.

Release note

docs(postgres): the tenant CA trust anchor is `postgres-<name>.tenant-ca`, not `<release>.tenant-ca`.

Summary by CodeRabbit

  • Documentation
    • Updated PostgreSQL TLS setup instructions with the correct tenant CA Secret name and retrieval command.
    • Clarified that tenant-accessible Secrets contain only the CA certificate, while the original Secret contains the private key.
    • Clarified CA sentinel access controls, including tenant isolation and helm-controller-managed behavior.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@dosubot dosubot Bot added the kind/documentation Categorizes issue or PR as related to documentation label Jul 27, 2026
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updated CA sentinel RBAC documentation and PostgreSQL TLS instructions. PostgreSQL guidance now references the tenant-accessible CA secret and identifies which secret contains the CA private key.

Changes

CA access documentation

Layer / File(s) Summary
CA sentinel RBAC boundary comments
internal/controller/cacert/reconciler.go, packages/system/cozystack-controller/templates/rbac.yaml
Comments describe the controlling RBAC group, helm-controller responsibility, and tenant exclusion from internal.cozystack.io.
PostgreSQL tenant CA retrieval
packages/apps/postgres/README.md
TLS instructions retrieve postgres-<name>.tenant-ca and clarify that it contains only ca.crt, while the CNPG CA secret contains ca.key.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: kvaps, myasnikovdaniil, sircthulhu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main documentation change: correcting the Postgres tenant trust-anchor name.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tenant-ca-doc-accuracy

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added area/database Issues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse) size/S This PR changes 10-29 lines, ignoring generated files labels Jul 27, 2026
@lexfrei
Aleksei Sviridkin (lexfrei) force-pushed the fix/tenant-ca-doc-accuracy branch 2 times, most recently from ed02cd8 to 293fc19 Compare August 10, 2026 11:37
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@myasnikovdaniil myasnikovdaniil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both claims check out against the code, and the second one is the more valuable half.

The naming fix is right and there is an independent witness for it. packages/system/postgres-rd/cozyrds/postgres.yaml:13 sets prefix: postgres- and api/v1alpha1/applicationdefinitions_types.go:82 defines release names as prefix plus app name, so a Postgres named foo is release postgres-foo. hack/e2e-chainsaw/postgres/chainsaw-test.yaml:155 asserts the Secret postgres-test.tenant-ca for an instance named test and line 232 runs the same command shape the README now prints. Read literally as a resource name, the old text gave NotFound.

The ValidatingAdmissionPolicy retraction is the part I would highlight. There is no VAP on internal.cozystack.io or tenantprojections anywhere in the tree, and git log -S "companion ValidatingAdmissionPolicy" shows the phrase arrived in the feature commit itself, so it was aspirational and never shipped. Deleting it is a security-documentation win, because a comment claiming a defence in depth that does not exist makes the next reviewer budget against it. The replacement claim is also true, the only RBAC grant on that group is the controller's own at packages/system/cozystack-controller/templates/rbac.yaml:29.

One loose end. The vocabulary migration stops inside the same paragraph. README.md:180 and :184 now say postgres-<name>, and :188 four lines later still says CNPG creates its own <release>-ca. The premise of this PR is that a tenant does not know what <release> expands to, and that does not stop being true two sentences later. It is postgres-<name>-ca, per hack/e2e-chainsaw/postgres/chainsaw-test.yaml:175. Same <release> survives at :169 for the external hostname, which renders as .Release.Name plus host, so it means the same thing.

Worth adding a half-line in internal/controller/cacert/reconciler.go noting the VAP was considered and rejected in favour of RBAC. That rationale is good and it currently lives only in the commit body, so the next reader will re-run your investigation.

@lexfrei Aleksei Sviridkin (lexfrei) added the debug Debugging in progress label Aug 14, 2026
@lexfrei
Aleksei Sviridkin (lexfrei) force-pushed the fix/tenant-ca-doc-accuracy branch 9 times, most recently from 21eccfc to 7a99967 Compare August 16, 2026 18:03
The README told a tenant to fetch <release>.tenant-ca, but the release
name carries the postgres- prefix the application definition applies, so
the object is postgres-<name>.tenant-ca. Following the old text returned
NotFound.

Also drop two comments promising a companion ValidatingAdmissionPolicy
that pins sentinel writes to helm-controller. No such policy ships: the
proposal for it was rejected because authorization by username duplicates
RBAC in a more brittle form. The RBAC boundary is the whole control.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@myasnikovdaniil
myasnikovdaniil merged commit 4bb141f into main Aug 17, 2026
41 of 43 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the fix/tenant-ca-doc-accuracy branch August 17, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/database Issues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse) debug Debugging in progress kind/documentation Categorizes issue or PR as related to documentation size/S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants