Files
cozystack/internal/controller
Andrei Kvapil 7fb2bc785a feat(rabbitmq)!: mint tenant passwords through the credentials API (#5381)
## What this PR does

This PR now carries three conversions: RabbitMQ, Redis/Valkey (reviewed
in #5382) and Bucket (reviewed in #5383). Those two were merged into
this branch instead of main by mistake, and since each was already
reviewed and approved on its own, they land here together rather than
being split out again.

RabbitMQ passwords are no longer readable from the per-user Secrets, and
tenants lose the administrator login from the operator's
`<release>-default-user`. Every tenant tier can read both today. An
administrator mints a password on the user's `Credential` and sees it
once, the topology operator applies it within seconds, and the next mint
or a revoke kills it. The broker hashes passwords itself, so the account
Secret keeps the plaintext, readable only by the platform. This is the
RabbitMQ part of the user secrets API design (cozystack/community#137).

Stacked on #5380. Review only the top four commits:

- The chart renders a `plaintext` CredentialTemplate per user and points
each `User`'s `importCredentialsSecret` at its account Secret. Password
generation and the `lookup` are gone.
- The lineage webhook package gets a helper that tells whether a
definition shows a Secret, with tests that load the converted
definitions.
- `credentials-migrate` gets `--source-selector`, to find per-user
Secrets by label, and `--hide-secret-suffix`, to hide a Secret the
operator created once the kind's new definition is in the API.
- Migration 68 seeds the account Secrets before the chart switches. Its
finish Job deletes the old per-user Secrets and hides `-default-user`.
It waits for the new definition first: on the upgrade run the operator
rewrote the Secret 7 s before rabbitmq-rd upgraded, and the webhook
stamped it tenant-visible again from the old definition. The exclude in
the new definition keeps it hidden on every later rewrite.

The design assumed the topology operator imports a password only when it
creates a user. Version 1.20.2 re-imports on every reconcile and watches
the Secret, so a mint applies live.

Tested on a three-node cluster, fresh install: a minted password works
after 5 s, the old one is rejected right after the next mint, revoke
works, and removing a user removes the broker user too. Every fresh
install fails once: the operator's webhook rejects a `User` whose Secret
doesn't exist yet, and the retry 32 s later converges. Full upgrade from
1.7.1 on the same cluster, all engines at once with a client loop each:
migrations 64-71 ran in order and every account was adopted with its old
password. The RabbitMQ client loop had no failures. That run showed the
7 s window above; the last two commits close it and are covered by
tests, not by a second run.

Breaking for users: tenants lose the administrator login and the
management UI, since chart users carry no tags. Passwords can't be read
any more. A fresh install, or an upgrade that adds a user, shows one
failed attempt before it converges.

Open questions:

1. The first failed attempt: accept it, or seed the account Secret
before the chart renders?
2. Add `users.<name>.tags`, so tenants can have an admin user again?
3. Rotate `-default-user` in the finish Job? That needs `pods/exec` for
`rabbitmqctl`. Otherwise the value tenants could read stays valid.

### 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 RabbitMQ note for the credentials API docs
(cozystack/website#753) and an upgrade note that tenants lose the
administrator login
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up: needed, `cozystack_rabbitmq` 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: needed, the RabbitMQ row in the design, and a fix to its
claim that the operator imports a password only on user creation

### Release note

```release-note
feat(rabbitmq)!: RabbitMQ passwords are issued through the credentials API. The per-user Secrets are removed, `users.<name>.password` is ignored, and tenants can no longer read the administrator login in `<release>-default-user`. 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. Switch clients to minted passwords after the upgrade.
```



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added credential templates for RabbitMQ, Redis, Valkey, and bucket
accounts, with credentials issued and managed through the credentials
API.
* Added platform-account settings for bucket users and support for
engine-issued bucket access keys.
* Credential mint responses now include an access key ID for services
that issue key pairs.
* **Improvements**
* Redis and Valkey passwords can be rotated without restarting; internal
accounts support replication and monitoring.
  * Tenant-visible access to platform credentials is more restricted.
* Added migrations for existing RabbitMQ, Redis, Valkey, and bucket
credentials.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-12-02 19:06:38 -05:00
..