percona / percona-postgresql-operator

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

K8SPG-509: backup/restore improvements #797

Closed pooknull closed 3 months ago

pooknull commented 4 months ago

K8SPG-509 Powered by Pull Request Badge

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

DESCRIPTION

Problem: In some rare cases, pg-cluster may have the .spec.restore field set to true even when there are no active restores.

Cause: After the restore job is complete, the operator attempts to update the status of pg-restore to Succeeded and then updates the pg-cluster. If the operator encounters an error during the pg-cluster update, no further attempts are made to update pg-cluster since pg-restore already has the Succeeded state.

Solution: Update pg-cluster first and update pg-restore as the last step.

Also, this PR fixes a problem when the user decides to delete the pg-backup while it's running. In that case, pg-cluster will have an annotation pgv2.percona.com/backup-in-progress which blocks the start of other backups. Now, the operator will check if the pg-backup provided in this annotation exists and delete the annotation if needed.

CHECKLIST

Jira

Tests

Config/Logging/Testability

JNKPercona commented 3 months 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/797/commits/07922ddb061684e48f2057bd4d3e2ccaeab39a6b image: perconalab/percona-postgresql-operator:PR-797-07922ddb0