Files
cozystack/packages/apps/postgres/tests/barman_resources_test.yaml
T
Yan Bondarenko 9214430bd8 fix(backups): give the barman-cloud sidecar its own resources
The barman-cloud plugin injects its sidecar without resource requests or
limits. Tenant namespaces ship a LimitRange that defaults containers to
128Mi, so the sidecar inherits that default and is OOMKilled mid-backup:
the ObjectStore stays healthy, the Cluster stays Ready, and only the
backup fails. A cgroup high-water mark of 254 MiB on a 38 MB database
shows the default cannot hold it.

The shared cozy-lib helper and the Go path that builds the platform's own
ObjectStore now request 100m/256Mi and cap memory at 1Gi. No CPU limit is
set, matching the entityOperator precedent in the kafka chart: a
throttled sidecar stalls WAL archiving instead of failing it.

The helper is renamed from checksumSidecarConfiguration to
sidecarConfiguration, since it no longer carries only the checksum pin.

Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
2026-09-18 17:30:20 +04:00

76 lines
2.0 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 limit
set:
backup.enabled: true
asserts:
- equal:
path: spec.instanceSidecarConfiguration.resources
value:
requests:
cpu: 100m
memory: 256Mi
limits:
memory: 1Gi
documentSelector:
path: kind
value: ObjectStore
- notExists:
path: spec.instanceSidecarConfiguration.resources.limits.cpu
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