mysql-operator
mysql-operator copied to clipboard
How to disable Pvc Cleaner?
https://github.com/presslabs/mysql-operator/pull/140/files#diff-fd332df34b6a8aed6f6e0cb14b640f07R203
I just think that PVC should stay or the data will be lost. I think there would an option that controls the behavior of how the operator manages PVC for data safe purpose.
Hi @chenmin1992, Ther is no method to disable the PVC cleaner but the operator does not delete the data for node 0, in any case, so your data is safe. Indeed there may be some corner cases that require more attention(what I'm thinking about is when you scale the cluster down to 1 replica and node 0 is not up-to-date and you can lose data).
Also, if the cluster is scaled down its essential to remove the PVC because after a while the data from that PVC become obsolete and when the cluster is scaled back up the replication will fail.
Please give me more details of what do you think about how the operator should manage PVCs.
@AMecea For me the only feature request here would be handling the "node 0 is out of date" case (maybe refuse to scale down to a number that stops the current master?)
@AMecea No, in my test case, PVC for node 0 is also deleted when deleting the mysqlcluster customresource haodai1.

Maybe the OwnerReferences delete the PVC associated with node 0.
Yes, after deleting OwnerReferences, the PVC-0 won't be deleted.
length of the parameter of ensureVolumeClaimTemplates is always 0 so far.
Hi @chenmin1992, the PVC should be deleted when the cluster is deleted. That's the intended behavior. If you want to preserve the data then scale the cluster down to zero.
@AMecea For me the only feature request here would be handling the "node 0 is out of date" case (maybe refuse to scale down to a number that stops the current master?)
@abh, this is indeed a problem that needs to be addressed and it's more complex. Here is something that I thought about https://github.com/presslabs/mysql-operator/issues/404#issuecomment-539555943
Hi @chenmin1992, the PVC should be deleted when the cluster is deleted. That's the intended behavior. If you want to preserve the data then scale the cluster down to zero.
I think it would be nice to have an option like persistentVolumeReclaimPolicy to retain PVC's (or at least 1 master one) on cluster deletion.
我也觉得应该有一个配置选项去控制pvc是否删除