Files
cozystack/packages/apps/postgres/tests/barman_resources_test.yaml
T
Mattia Eleuteri f1dd2d17fc fix(backups): give the barman-cloud sidecar an explicit CPU limit
The sidecar was left without a CPU limit so that a throttled sidecar
would slow WAL archiving down rather than fail it. In a tenant with
resourceQuotas that does not hold: the tenant LimitRange gives every
container a 250m CPU limit by default, so the sidecar gets it and
compresses full backups and WAL segments on a quarter of a core. A
1.6 GB database took 30 minutes to back up.

Set an explicit one-core limit in both places that build the sidecar
configuration, the backup driver and cozy-lib, the same way the memory
request and limit already override the LimitRange defaults.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
2026-11-11 09:20:19 +01:00

72 lines
1.9 KiB
YAML

suite: Barman resources under tenant container limits
templates:
- templates/db.yaml
release:
name: postgres-source
namespace: tenant-test
set:
_cluster:
scheduling: {}
backup:
destinationPath: s3://backups/test/
endpointURL: https://s3.example.org
s3CredentialsSecret:
name: postgres-backup
tests:
- it: sets resources for native backup without inheriting the tenant 128Mi and 250m limits
set:
backup.enabled: true
asserts:
- equal:
path: spec.instanceSidecarConfiguration.resources
value:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: "1"
memory: 1Gi
documentSelector:
path: kind
value: ObjectStore
- equal:
path: spec.configuration.s3Credentials.accessKeyId.name
value: postgres-backup
documentSelector:
path: kind
value: ObjectStore
- it: gives recovery its own resources while backup remains disabled
set:
backup.enabled: false
bootstrap:
enabled: true
oldName: postgres-original
asserts:
- equal:
path: spec.instanceSidecarConfiguration.resources.limits.memory
value: 1Gi
documentSelector:
path: kind
value: ObjectStore
- equal:
path: metadata.name
value: postgres-source-recovery
documentSelector:
path: kind
value: ObjectStore
- equal:
path: spec.externalClusters[0].plugin.parameters.serverName
value: postgres-original
documentSelector:
path: kind
value: Cluster
- it: does not enable backup for an application that has not requested it
asserts:
- hasDocuments:
count: 2
- notExists:
path: spec.plugins
documentSelector:
path: kind
value: Cluster