Files
Alexey Artamonov f02ca8cbc2 test(backups): log in as an application user after each restore
The backup examples and e2e suites no longer set passwords. They read
the generated ones from <release>-credentials with jq, since a username
may contain a dot that jsonpath treats as a path step, and log in as an
application user after each restore, so a restore that leaves the
credentials unusable fails the run. The MariaDB run also checks that an
account created out of band on the source is absent from the copy. The
unreachable-target restore step asserts a terminal Failed attributed to
the recovery window, since the reason itself is best effort.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
2026-09-24 18:11:07 +03:00

49 lines
1.8 KiB
YAML

# Source Postgres instance.
#
# backup.enabled is true so the chart renders spec.backup.barmanObjectStore
# on the Cluster from helm-install. CNPG then starts postgres with
# archive_command=barman-cloud-wal-archive instead of /bin/true, and WALs
# flow to object storage from the very first segment switch. If we left
# backup.enabled=false and relied on the BackupClass driver to inject
# barmanObjectStore at BackupJob time, archive_command would still be a
# no-op when the backup's begin_wal closes - that WAL never lands in S3,
# and recovery later fails with "WAL not found" while the source PVC is
# already gone.
#
# Coupling: the e2e harness substitutes REPLACE_WITH_COSI_BUCKET_NAME and
# REPLACE_WITH_S3_ENDPOINT before apply, mirroring 10-cnpg-strategy.yaml.
# Outside the e2e a human reader edits these to the bucket / endpoint
# their environment uses.
---
apiVersion: apps.cozystack.io/v1alpha1
kind: Postgres
metadata:
name: pg-src
spec:
replicas: 2
size: 5Gi
databases:
demo:
roles:
admin:
- app
users:
app: {}
backup:
enabled: true
# schedule intentionally empty: we do NOT use the chart's legacy
# cnpg.io/ScheduledBackup. Recurring backups are driven by the
# BackupClass + Plan flow (15-backupclass.yaml + 20-plan.yaml), and
# ad-hoc backups go through 25-backupjob-adhoc.yaml. backup.enabled
# above is only here to bootstrap archive_command on the source
# cluster from helm-install onwards - leaving it false would write
# the backup's begin_wal to /bin/true and break recovery later.
schedule: ""
destinationPath: s3://REPLACE_WITH_COSI_BUCKET_NAME/pg-src/
endpointURL: https://REPLACE_WITH_S3_ENDPOINT
endpointCA:
name: pg-src-cnpg-backup-ca
key: ca.crt
s3CredentialsSecret:
name: pg-src-cnpg-backup-creds