Repository navigation
Description
Is there an existing issue already for this feature request/idea?
- I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.
What problem is this feature going to solve? Why should it be added?
Issue #11519 added documentation and samples for a read-only DBA persona. During that discussion, @LaurentP-Pro described a second persona that CloudNativePG does not support today: automation (CI/CD, GitOps controllers, platform tooling) that needs write access to postgresql.cnpg.io resources, in a single namespace, without cluster-admin.
Today the project ships editor roles only for some resources, and not in a consistent way:
| Resource | Editor role file in config/rbac/ |
Listed in kustomization.yaml |
|---|---|---|
Database, Publication, Subscription |
yes | yes |
Cluster, Backup, Pooler, ScheduledBackup |
yes | no, so not shipped |
ImageCatalog, ClusterImageCatalog |
no | no |
DatabaseRole |
no | no |
FailoverQuorum |
no | no |
The practical consequence, as reported in #11519: a team that cannot create ClusterRole objects ends up widening the operator's own cnpg-manager role and aggregating it into the built-in admin role, only to be able to patch an ImageCatalog. Every later release that widens the operator's RBAC then silently widens what namespace admins get, with no review gate.
Describe the solution you'd like
Define, document and ship a complete set of editor roles, taking into account that write access to several of these resources is a high-privilege grant (see "RBAC on Custom Resources" in docs/src/security.md).
Proposed scope, to be refined in this issue:
- Ship the editor roles that already exist (
Cluster,Backup,Pooler,ScheduledBackup) by listing them inconfig/rbac/kustomization.yaml. - Add the missing editor roles for
ImageCatalogandClusterImageCatalog. Note thatClusterImageCatalogis cluster-scoped, so granting it requires aClusterRoleBinding, which is out of reach for users who cannot create one. The documentation should say so explicitly. - Decide, resource by resource, whether an editor role should exist at all:
DatabaseRole:superuser: trueandinRolesmake write access equivalent to PostgreSQL superuser access on the namespace.Pooler:authQueryruns arbitrary SQL, with the same implication.FailoverQuorum: written by the operator and read-only for users, so it gets no editor role. Users already see it through the read-only roles. Where a role is shipped, its description should state the privilege it effectively grants.
- A single aggregate editor role (counterpart of
cnpg-viewer-role), limited to the resources judged safe in the previous point, and a way to keep the high-privilege ones separate. - Opt-in aggregation into the built-in
adminandeditroles, off by default, as an alternative to wideningcnpg-manager. This must stay an explicit decision of the platform team, since it affects every namespace. - Documentation in
docs/src/security.md: the automation persona, the available editor roles, and whichkubectl cnpgcommands each one enables (backup,restart,promote,fence,hibernate,maintenance, ...). - Helm chart: mirror the new roles in
cloudnative-pg/charts, which needs its own change.
Describe alternatives you've considered
- Keep documenting samples only. It does not solve the drift problem: every new CRD requires every adopter to update their own manifest.
- Ship a single all-powerful editor role. Simple, but it hides the fact that some of the resources (
DatabaseRole,Pooler) are close to superuser access, and it removes the ability to grant them separately. - Widen
cnpg-managerand aggregate it intoadmin(the current workaround). Rejected: it couples the operator's privileges to what users receive.
Additional context
- Origin: Document and provide sample RBAC for a read-only "DBA" persona #11519, in particular the comment from @LaurentP-Pro describing the automation persona and the
imagecatalog-editor-rolegap. - Read-only counterpart:
cnpg-viewer-roleand the DBA persona samples. - Related, in
cloudnative-pg/klio: thePluginConfigurationresource has no viewer or editor role, onlyServerdoes.
Backport?
No
Are you willing to actively contribute to this feature?
Yes
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
docs(rbac): ship a reviewed set of editor roles for automation
docs(rbac): ship a reviewed set of editor roles for automation
docs(rbac): ship a reviewed set of editor roles for automation
docs(rbac): ship a reviewed set of editor roles for automation
docs(rbac): ship a reviewed set of editor roles for automation
docs(rbac): ship a reviewed set of editor roles for automation
docs(rbac): ship a reviewed set of editor roles for automation
mnencia commentedon Nov 16, 2026
#11784 covers this issue, with one change from the proposal.
cnpg-editor-rolealso includesDatabaseRoleandPooler, which the issue wanted kept out. Write access toClusteralready gives PostgreSQL superuser access (spec.managed.rolesacceptssuperuserandinRoles) and the ability to create arbitrary Pods (cnpg.io/podPatch). Keeping the two resources out of the aggregate role added no protection, and it made the role look safer than it is. The docs now say thatcnpg-editor-roleis high privilege.cnpg-databaserole-editor-roleandcnpg-pooler-editor-roleare still shipped for anyone who binds them alone, and theImageCatalogandClusterImageCatalogroles are marked high privilege too, because they control the image aClusterruns.The Helm chart (item 7) is handled at release time.
feat(rbac): ship a reviewed set of editor roles for automation (cloud…