percona / percona-postgresql-operator

Percona Operator for PostgreSQL
https://www.percona.com/doc/kubernetes-operator-for-postgresql/index.html
Apache License 2.0
254 stars 50 forks source link

K8SPG-502: cleanup outdated backups #763

Closed pooknull closed 1 month ago

pooknull commented 1 month ago

K8SPG-502 Powered by Pull Request Badge

https://perconadev.atlassian.net/browse/K8SPG-502

DESCRIPTION

Problem: pg-backup and backup jobs are not being cleaned up after the backup was deleted by pgbackrest, i.e., due to `repo-retention-` options.*

Solution: The operator should check for available backups using the pgbackrest info command and delete expired backups.

It is not possible to distinguish which pg-backup corresponds to the record in pgbackrest info if it was created with the old version of the operator. To solve this problem, it was decided not to clean up backups created with the old operator version. To be able to distinguish between pg backups from the old operator version and those from the new version, the field .status.crVersion has been added.

CHECKLIST

Jira

Tests

Config/Logging/Testability

JNKPercona commented 1 month ago
Test name Status
custom-extensions passed
demand-backup passed
init-deploy passed
monitoring passed
one-pod passed
operator-self-healing passed
pitr passed
scaling passed
scheduled-backup passed
self-healing passed
start-from-backup passed
tablespaces passed
telemetry-transfer passed
upgrade-consistency passed
upgrade-minor passed
users passed
We run 16 out of 16

commit: https://github.com/percona/percona-postgresql-operator/pull/763/commits/cf04e48ce3e330bfc166a7e68a5f31eae0c8132c image: perconalab/percona-postgresql-operator:PR-763-cf04e48ce