cozystack/hack
Andrei Kvapil 23b1f5d708
[mongodb] Unify users and databases configuration (#1923)
## What this PR does

Aligns MongoDB configuration with postgres and mysql patterns by
introducing a separate `databases` section.

**Before:**
```yaml
users:
  myuser:
    db: mydb
    roles:
      - name: readWrite
        db: mydb
      - name: dbAdmin
        db: mydb
```

**After:**
```yaml
users:
  myuser: {}

databases:
  mydb:
    roles:
      admin:
        - myuser
      readonly:
        - reader
```

Changes:
- Add separate `databases` section with `roles.admin` and
`roles.readonly`
- Simplify `users` to only contain optional password field
- All users authenticate via `admin` database (MongoDB production best
practice)
- `admin` role maps to `readWrite` + `dbAdmin` permissions
- `readonly` role maps to `read` permission

## Migration

Includes migration script (`migrations/24`) that automatically converts
existing MongoDB HelmReleases:
- Detects old format users (with `db` and `roles` fields)
- Converts `readWrite`/`dbAdmin` roles → `databases.{db}.roles.admin`
- Converts `read` role → `databases.{db}.roles.readonly`
- Preserves user passwords in new `users` format
- Skips HelmReleases that don't have old format

### Release note

```release-note
[mongodb] Unified users and databases configuration to match postgres and mysql patterns. Users now defined separately from databases, with role assignments in the databases section. Includes automatic migration for existing deployments.
```
2026-02-02 22:06:03 +01:00
..
e2e-apps refactor(mongodb): unify users and databases configuration 2026-01-27 23:24:42 +01:00
boilerplate.go.txt Introduce cozystack-controller (#560) 2025-01-09 12:24:51 +01:00
cdi_golden_image_create.sh [virtual-machine] Refactor golden images 2025-07-03 13:33:44 +03:00
check-optional-repos.sh Rename cozypkg to cozyhr 2025-12-25 16:54:22 +01:00
collect-images.sh [dx] Refactor collect-images functionality 2025-07-03 14:26:56 +03:00
common-envs.mk refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
cozyreport.sh feat(flux): implement flux sharding for tenant HelmReleases 2026-01-15 14:15:09 +01:00
cozytest.sh [tests] Add more space for e2e tests 2025-08-11 13:04:00 +03:00
download-dashboards.sh [monitoring] add seaweedfs monitoring 2025-07-30 15:17:46 +03:00
e2e-install-cozystack.bats feat(cozypkg): add cross-platform build targets with version injection 2026-01-15 17:18:01 +01:00
e2e-prepare-cluster.bats [ci] Run e2e tests on shared runners 2026-01-20 22:13:16 +01:00
e2e-test-openapi.bats [apps] Refactor apiserver to use typed objects and fix UnstructuredList GVK 2025-12-01 22:06:23 +01:00
helm-unit-tests.sh [ci,dx] Add unit tests for cozy-lib 2025-11-19 17:56:17 +03:00
migrate-to-version-1.0.sh Post upgrade fixes for v1.0 migration script 2026-01-29 20:44:22 +03:00
package.mk refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
pre-checks.sh Fix osx grep have no -P flag (#438) 2024-10-21 11:59:56 +02:00
update-codegen.sh refactor(api): rename CozystackResourceDefinition to ApplicationDefinition 2026-01-15 22:35:56 +01:00
update-crd.sh refactor(labels): remove cozystack.io/ui label 2026-01-19 13:59:29 +01:00
upload-assets.sh feat(installer): split operator manifest into talos/generic/hosted variants 2026-01-30 23:12:24 +03:00
upload-releasenotes.sh Add AI-agent for changelogs generation 2025-11-26 20:18:43 +01:00