mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 20:23:39 +09:00
## What this PR does The barman-cloud sidecar of Postgres backups is deliberately left without a CPU limit, so that a throttled sidecar slows WAL archiving down instead of failing it. In a tenant with `resourceQuotas` set that intent does not hold: `packages/apps/tenant/templates/quota.yaml` creates the `tenant-range-limits` LimitRange, whose default CPU limit is `250m`, and the sidecar receives it. Full backups and WAL segments are then gzip-compressed on a quarter of a core. On a production tenant the first full backup of a 1.6 GB database took 30 minutes, uploading at about 0.5 MB/s with the sidecar pinned at its 250m limit, while a small database on the same destination finished in 35 seconds. This sets an explicit `limits.cpu: "1"` on the sidecar, in the two places that build its configuration: `barmanSidecarConfiguration` in the backup driver (platform-managed ObjectStores) and `cozy-lib.barman.sidecarConfiguration` (ObjectStores rendered by the postgres and keycloak charts). This mirrors how the memory request and limit there already override the LimitRange's 128Mi default. One core removes the 250m ceiling without letting the sidecar starve the instance. Inside a tenant it counts against the `limits.cpu` quota, one core per instance pod; the comments now say so. The sidecar is injected when the instance pod is created, so existing instances pick the new limit up at their next restart. Tests: the Go test that asserted the absence of a CPU limit now asserts one core, and so does `packages/apps/postgres/tests/barman_resources_test.yaml`. Both fail with the implementation reverted and pass with it. `go test ./internal/backupcontroller/`, `helm unittest packages/apps/postgres` (220) and `helm unittest packages/system/keycloak` (121) pass. ### Screenshots Not a UI change. ### Downstream repositories Walked the trigger map against the diff (the backup driver, `cozy-lib`'s barman template, two tests): no app, value, schema, default, CRD, annotation or tooling change, so none of the listed repositories restates anything touched here. - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [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 fix(backups): the barman-cloud sidecar of Postgres backups now has an explicit one-core CPU limit instead of inheriting the tenant LimitRange's 250m default, which made full backups and WAL archiving several times slower. Each instance pod of a tenant with a CPU quota now counts 750m more against `limits.cpu`; check the headroom before instance pods are recreated. Existing ObjectStores pick the limit up at their next backup (platform-managed) or HelmRelease upgrade (chart-rendered), and running pods at their next restart. ```