mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-05 14:42:05 +09:00
## What this PR does ClickHouse passwords are no longer readable from `<release>-credentials` and can't be set through `users.<name>.password`. Today every `use` member reads them there, and a leaked one can't be taken back. Now an administrator mints a password on the user's `Credential`, sees it once, and the next mint or a revoke kills it. This is the ClickHouse part of the user secrets API design (cozystack/community#137). Stacked on #4922. Review only the top four commits: - `credentials-migrate` gets `--reserved-user`, `--values-path` and `--rotate-key`. - `credentials-migrate` can hold a kind's releases until given Deployments run their new images. - The chart renders a `sha256` CredentialTemplate per user and reads the stored hash through `valuesFrom`, since the ClickHouse operator reads no Secrets. `backup`, `default` and `clickhouse_operator` are refused as user names. - Migration 65 seeds the account Secrets from `<release>-credentials` and suspends the ClickHouse releases before the chart switches. Its finish Job, under its own `cozystack-credentials-migration-65` identity, resumes them only after the new cozystack-controller and cozystack-api run, then removes the tenant keys and rotates `backup` once, because tenants could read it. The hold exists because the old controller strips the `valuesFrom` entries the migration adds: without it the new chart rendered no users, and clients were locked out for 10 minutes on the first upgrade run. Tested on a three-node cluster, fresh install: a minted password logs in after about 60 s (the Helm re-render), the old one dies 2 s after the next mint, revoke works, and removing a user removes everything. Mints restart nothing. 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 ClickHouse releases were held for 19 minutes and the client loop saw no authentication error. Breaking for users: passwords can't be read any more, and each mint costs a Helm upgrade of about a minute. Pods restart once during the conversion for the `backup` rotation. While the hold lasts (19 minutes on the test cluster) the ClickHouse apps can't be changed or deleted. A release with a user named `backup`, `default` or `clickhouse_operator` is not converted and raises `CredentialsMigrationIncomplete`. Open questions: 1. `users.default` is refused, as the design says. Tenants may be using it today, so should it be a mintable account instead? 2. A Helm upgrade already running during the `backup` rotation can write the old value back. Should finish wait for the release to be idle? ### 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 ClickHouse note for the credentials API docs (cozystack/website#753) and an upgrade note that clients must mint - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: needed, `cozystack_clickhouse` 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(clickhouse)!: ClickHouse 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 after the next Helm upgrade of the release, about a minute. Existing passwords keep working through the upgrade, and migration 65 rotates the platform `backup` password, which restarts each ClickHouse instance once. A release with a user named `backup`, `default` or `clickhouse_operator`, or with a name that does not map to a valid account name, is not converted until the user is renamed; renaming a ClickHouse user means changing the apps that log in as it. 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** * ClickHouse account passwords can now be issued and revoked through the credentials API. Newly issued passwords are available once and can be used to log in after the release is upgraded. * Platform-managed accounts are reserved, and account names are validated for conflicts and supported formats. * Platform upgrades now migrate existing ClickHouse credentials and support backup-password rotation. * **Bug Fixes** * Tenant account passwords are no longer stored in the ClickHouse credentials Secret; only the platform backup password remains there. * The credentials Secret is no longer exposed as a tenant resource. <!-- end of auto-generated comment: release notes by coderabbit.ai -->