Hi,
I would like to propose a new feature that allows deleting a DatabaseCluster while intentionally retaining its DatabaseClusterBackup objects and associated data on object storage (S3/Azure Blob), so that backups can be used to restore data into a new cluster later.
Feature Request
Current Behavior
When a DatabaseCluster is deleted, all associated DatabaseClusterBackup objects are always deleted via two mechanisms:
1. Operator explicitly deletes backups
In HandleDBBackupsCleanup, the operator actively calls deleteBackupsForDatabase which deletes all DatabaseClusterBackup objects before proceeding with cluster deletion.
2. Kubernetes GC cascade via ownerReferences
Every DatabaseClusterBackup has an ownerReference with blockOwnerDeletion: true pointing to its DatabaseCluster. Once the DatabaseCluster CR is fully gone, Kubernetes GC automatically deletes all owned backups - even when using kubectl delete --cascade=orphan.
Expected Behavior
Users should be able to delete a DatabaseCluster while retaining its DatabaseClusterBackup objects and the associated backup data on object storage, so that they can restore into a new cluster later.
This is a common pattern in managed database services - for example AWS RDS supports "retain automated backups" when deleting a DB instance.
Proposed Solution
Introduce an annotation everest.percona.com/keep-backups: "true" on DatabaseCluster:
apiVersion: everest.percona.com/v1alpha1
kind: DatabaseCluster
metadata:
name: my-cluster
annotations:
everest.percona.com/keep-backups: "true"
When this annotation is present during deletion:
- Skip
deleteBackupsForDatabase in HandleDBBackupsCleanup
- Skip the
len(backupList.Items) != 0 check in HandleUpstreamClusterCleanup
- Maybe detach ownerReference from all DatabaseClusterBackup objects before the DatabaseCluster CR is fully gone, so Kubernetes GC does not cascade delete them
After deletion, retained backups can be used to restore into a new cluster via DatabaseClusterRestore:
apiVersion: everest.percona.com/v1alpha1
kind: DatabaseClusterRestore
metadata:
name: restore-from-retained-backup
spec:
dbClusterName: my-new-cluster
dataSource:
dbClusterBackupName: my-retained-backup
Additional Context
- Restoring from a retained backup requires only the
DatabaseClusterBackup CR and the BackupStorage CR - the original DatabaseCluster is not needed
DatabaseClusterBackup.spec.dbClusterName already captures the cluster relationship via field index, so removing ownerReference does not break any query or reconcile logic
Thank you
Hi,
I would like to propose a new feature that allows deleting a DatabaseCluster while intentionally retaining its DatabaseClusterBackup objects and associated data on object storage (S3/Azure Blob), so that backups can be used to restore data into a new cluster later.
Feature Request
Current Behavior
When a
DatabaseClusteris deleted, all associatedDatabaseClusterBackupobjects are always deleted via two mechanisms:1. Operator explicitly deletes backups
In
HandleDBBackupsCleanup, the operator actively callsdeleteBackupsForDatabasewhich deletes allDatabaseClusterBackupobjects before proceeding with cluster deletion.2. Kubernetes GC cascade via
ownerReferencesEvery
DatabaseClusterBackuphas anownerReferencewithblockOwnerDeletion: truepointing to itsDatabaseCluster. Once theDatabaseClusterCR is fully gone, Kubernetes GC automatically deletes all owned backups - even when usingkubectl delete --cascade=orphan.Expected Behavior
Users should be able to delete a
DatabaseClusterwhile retaining itsDatabaseClusterBackupobjects and the associated backup data on object storage, so that they can restore into a new cluster later.This is a common pattern in managed database services - for example AWS RDS supports "retain automated backups" when deleting a DB instance.
Proposed Solution
Introduce an annotation
everest.percona.com/keep-backups: "true"onDatabaseCluster:When this annotation is present during deletion:
deleteBackupsForDatabaseinHandleDBBackupsCleanuplen(backupList.Items) != 0check inHandleUpstreamClusterCleanupAfter deletion, retained backups can be used to restore into a new cluster via
DatabaseClusterRestore:Additional Context
DatabaseClusterBackupCR and theBackupStorageCR - the originalDatabaseClusteris not neededDatabaseClusterBackup.spec.dbClusterNamealready captures the cluster relationship via field index, so removingownerReferencedoes not break any query or reconcile logicThank you