Skip to content

[Feature]: Provide a complete, reviewed set of editor roles for the automation persona #11685

Description

@gbartolini

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:

  1. Ship the editor roles that already exist (Cluster, Backup, Pooler, ScheduledBackup) by listing them in config/rbac/kustomization.yaml.
  2. Add the missing editor roles for ImageCatalog and ClusterImageCatalog. Note that ClusterImageCatalog is cluster-scoped, so granting it requires a ClusterRoleBinding, which is out of reach for users who cannot create one. The documentation should say so explicitly.
  3. Decide, resource by resource, whether an editor role should exist at all:
    • DatabaseRole: superuser: true and inRoles make write access equivalent to PostgreSQL superuser access on the namespace.
    • Pooler: authQuery runs 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.
  4. 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.
  5. Opt-in aggregation into the built-in admin and edit roles, off by default, as an alternative to widening cnpg-manager. This must stay an explicit decision of the platform team, since it affects every namespace.
  6. Documentation in docs/src/security.md: the automation persona, the available editor roles, and which kubectl cnpg commands each one enables (backup, restart, promote, fence, hibernate, maintenance, ...).
  7. 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-manager and aggregate it into admin (the current workaround). Rejected: it couples the operator's privileges to what users receive.

Additional context

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

Activity

  1. self-assigned this
    on Oct 17, 2026
  2. added
    triage
    on Oct 17, 2026
  3. added a commit that references this issue on Oct 28, 2026
    e5cf228
  4. added a commit that references this issue on Nov 6, 2026
    c369a5e
  5. added
    documentation 📖
    enhancement 🪄
    and removed
    triage
    on Nov 6, 2026
  6. added this to the 1.31.0 milestone on Nov 6, 2026
  7. moved this to Waiting for First Review in CloudNativePG operator developmenton Nov 6, 2026
  8. added a commit that references this issue on Nov 10, 2026
    28431e1
  9. added 2 commits that reference this issue on Nov 13, 2026
    14b96a9
    dd4939c
  10. added 2 commits that reference this issue on Nov 16, 2026
    b31237e
    6ba2c14
  11. mnencia commented on Nov 16, 2026

    @mnencia
    Member

    #11784 covers this issue, with one change from the proposal.

    cnpg-editor-role also includes DatabaseRole and Pooler, which the issue wanted kept out. Write access to Cluster already gives PostgreSQL superuser access (spec.managed.roles accepts superuser and inRoles) 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 that cnpg-editor-role is high privilege. cnpg-databaserole-editor-role and cnpg-pooler-editor-role are still shipped for anyone who binds them alone, and the ImageCatalog and ClusterImageCatalog roles are marked high privilege too, because they control the image a Cluster runs.

    The Helm chart (item 7) is handled at release time.

  12. moved this from Waiting for First Review to Done in CloudNativePG operator developmenton Nov 16, 2026
  13. added a commit that references this issue on Nov 16, 2026
    25efd0e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentation 📖enhancement 🪄

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions