Summary
With the platform-managed backup flow (backup.useSystemBucket: true + cozy-default BackupClass), the first Postgres BackupJob fails because the CNPG instance-manager Pod cannot read the projected cozy-backups-creds Secret: cannot get secret cozy-backups-creds ... forbidden. No Role/RoleBinding grants the Postgres cluster ServiceAccount read access to that Secret.
Evidence
- The backup controller projects the credentials Secret but creates no accompanying RBAC for the consuming SA:
internal/backupcontroller/ (credentials_projector.go, cnpgstrategy_controller.go) contains no Role/RoleBinding creation (grep for RoleBinding returns nothing).
- The CNPG driver SSA-patches
spec.backup.barmanObjectStore onto the live Cluster with a secretKeyRef to cozy-backups-creds (internal/backupcontroller/cnpgstrategy_controller.go), which the instance-manager then reads under the postgres-<release> ServiceAccount.
- The only Role emitted by the Postgres chart,
packages/apps/postgres/templates/dashboard-resourcemap.yaml, grants get on Secrets only for resourceNames: [<release>-credentials], and its subjects are tenant use-tier users, not the CNPG ServiceAccount. It does not cover cozy-backups-creds.
- No other template or controller creates a Role granting the CNPG SA read access to the projected Secret.
Impact
- The first BackupJob against
cozy-default fails with a forbidden error on a fresh platform-managed Postgres backup setup. The backup path does not work out of the box until the missing RBAC is added.
Proposed fix
Emit a Role + RoleBinding in the Postgres chart (or have the backup controller create it alongside the projected Secret) granting the CNPG cluster ServiceAccount get on the cozy-backups-creds Secret in the tenant namespace, created before/atomically with the projected Secret so the instance-manager never hits a forbidden window.
Summary
With the platform-managed backup flow (
backup.useSystemBucket: true+cozy-defaultBackupClass), the first Postgres BackupJob fails because the CNPG instance-manager Pod cannot read the projectedcozy-backups-credsSecret:cannot get secret cozy-backups-creds ... forbidden. No Role/RoleBinding grants the Postgres cluster ServiceAccount read access to that Secret.Evidence
internal/backupcontroller/(credentials_projector.go,cnpgstrategy_controller.go) contains noRole/RoleBindingcreation (grep forRoleBindingreturns nothing).spec.backup.barmanObjectStoreonto the live Cluster with asecretKeyReftocozy-backups-creds(internal/backupcontroller/cnpgstrategy_controller.go), which the instance-manager then reads under thepostgres-<release>ServiceAccount.packages/apps/postgres/templates/dashboard-resourcemap.yaml, grantsgeton Secrets only forresourceNames: [<release>-credentials], and its subjects are tenantuse-tier users, not the CNPG ServiceAccount. It does not covercozy-backups-creds.Impact
cozy-defaultfails with aforbiddenerror on a fresh platform-managed Postgres backup setup. The backup path does not work out of the box until the missing RBAC is added.Proposed fix
Emit a Role + RoleBinding in the Postgres chart (or have the backup controller create it alongside the projected Secret) granting the CNPG cluster ServiceAccount
geton thecozy-backups-credsSecret in the tenant namespace, created before/atomically with the projected Secret so the instance-manager never hits aforbiddenwindow.