postgres-operator
postgres-operator copied to clipboard
Retain PVCs on PostgresCluster delete
Overview
When deleting a PostgresCluster CRD, the operator also deletes it's PVCs. I'd love to see a configuration option on the operator/cluster CRD that allows us to retain the PVC and the attached PV.
I know there is a guide to retain the PVs by doing some manual patching. However, it is cumbersome to reattach the PVs to a new Cluster, especially in a fully automated scenario. Newly provisioned persistent volumes claim do not work well with label selectors (e.g. dynamic provisioning with selector labels is not supported on AKS and EKS).
Use Case
- Easier recovery by mounting existing PVCs to StatefulSet deployed by the operator instead of having to reattach PVs to PVCs
- Many operators keep the PVCs by default, i.e. they do not prune the data upon CRD deletion. This is more intuitive in my opinion
Desired Behavior
A configuration option on either the operator or the PostgresCluster CRD, that allows to retain PVCs on PostgresCluster deletion. E.g. retainPvcs: true
Environment
Tell us about your environment:
Please provide the following details:
- Platform:
AKS
- Platform Version:
1.26.3
- PGO Image Tag: (e.g.
ubi8-5.3.1-0
) - Postgres Version (e.g.
15
) - Storage: (e.g.
hostpath
,nfs
, or the name of your storage class) - Number of Postgres clusters: 2
Additional Information
NA
Hello @nbrns. Thank you for your use-case information. I've added a note about this feature request to our backlog for future development. Regarding your specific scenario, do I understand correctly that you always keep all associated PVCs or do you only need to retain a subset of them?
Thanks for noting our use case!
I would like to keep all PVCs associated to a Postgres Cluster and its respective StatefulSets
Understood, thanks! I've updated our backlog accordingly.
This would be a very welcome addition, similar to #3654