## What this PR does
Postgres passwords are no longer readable from `<release>-credentials`,
which every `use` member and every parent tenant can read today, and
`users.<name>.password` is ignored. An administrator mints a password on
the user's `Credential` and sees it once. The account Secret stores only
the SCRAM verifier, CloudNativePG applies it, and the next mint or a
revoke kills the previous password. This is the Postgres part of the
user secrets API design (cozystack/community#137) on top of #4921.
- The chart renders one `scram-sha-256` CredentialTemplate per user and
points each managed role at its account Secret.
- The CloudNativePG bootstrap secret of the `app` owner is now that
user's account Secret, so the chart no longer generates a password into
`<release>-app-owner`.
- `users.<name>.createRole: true` is refused at render. A CREATEROLE
user becomes a member of each role it creates, CloudNativePG revokes
every membership a managed role does not declare, and that revoke fails
on the dependent grant, so the role gets stuck in `cannotReconcile`.
CloudNativePG has no per-role switch to leave memberships alone.
- `credentials-migrate` and migration 64 convert existing releases. The
pre-upgrade hook applies the CredentialTemplate CRD, writes each account
Secret from the current password as a verifier, and marks the release
for seeding only when every account got one. The finish Job runs under
its own `cozystack-credentials-migration-64` identity and removes
`<release>-credentials` once the controller adopted the accounts. A
transient API error is retried before a release is recorded as left out.
Live results, on a three-node test cluster upgraded from 1.7.1, with a
client logging in every second:
- Upgrade: the migration wrote the verifiers, the controller adopted
them, the finish Job removed the old Secret, and the client logged in
1014 times with no failure. A later run that upgraded all converted
engines at once (migrations 64-71) also had no Postgres failure, for
`web` and for the database owner `app`.
- A mint returns a password that logs in over TCP; the next mint and a
revoke each kill the previous password within 2 s. A stale precondition
gets 409 with no password, and a tenant viewer can't mint.
- Removing a user removes its template, Secret and role. `createRole:
true` fails at render.
- After a mint on `app`, the password survived a primary failover and
two restarts: CloudNativePG did not reset it from the bootstrap Secret.
Breaking for users: passwords can't be read any more, so clients switch
to a minted one after the upgrade. A release with `users.*.createRole:
true` is left out of the conversion: it keeps its previous chart
version, raises `CredentialsMigrationIncomplete`, and fails every
upgrade until the flag is set to `false`.
The red `E2E (in-tree)` comes from `mariadb-2-backup-roundtrip`, where
SeaweedFS rejected a freshly granted BucketAccess key before any
Postgres code ran; the three postgres tests pass.
### Screenshots
No UI change.
### Downstream repositories
- [ ] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up: needed, a Postgres note for the credentials API docs
(cozystack/website#753) and an upgrade note that clients must mint and
`createRole` must be off
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up: needed, `cozystack_postgres` still sends
`users.<name>.password`
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:
### Release note
```release-note
feat(postgres)!: Postgres passwords are issued through the credentials API and are no longer readable from `<release>-credentials`; `users.<name>.password` is ignored. An administrator mints a password on the user's Credential; it is shown once and applies within seconds. Existing passwords keep working through the upgrade: migration 64 converts every Postgres release and then removes the old Secret. `users.<name>.createRole: true` is no longer supported: a release that sets it is not converted, raises `CredentialsMigrationIncomplete` and fails its upgrades until the flag is set to `false`. Switch clients to minted passwords after the upgrade.
```