-
-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lazy cleanup of PVC on Mysql cluster deletion #125
Conversation
Hi @smanpathak, nice work! Interesting issue with Datera storage provided. I've worked for several weeks at refactoring the operator code, we use kubebuilder as SDK for the operator. The code is much clearer now. Can you please make this PR to the Also in the |
@AMecea thanks, I will look into porting the change over to kubebuilder branch. Here's my proposal --
|
This solution looks pretty good to me. You should find a way to implement a loop where to remove the finalizers that meet condition from 2. Take a look at how reconciliation is implemented in the new version, as a separated controller. In this refactoring, we focus on separation of concerns, and we give our best to make the code as clean as possible. @calind what is your opinion about this solution that @smanpathak proposed? |
Looks like k8s has what we are trying to build in the operator: kubernetes/kubernetes#55824. It basically puts a finalizer on PVC and removes the finalizer after all pods referencing the volume are deleted, allowing the deletion to go through. It is disabled by default, though |
@AMecea given the new ability of kubernetes finalizer, I intend to
|
Closing in favor of: #134 |
Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
Initial fix #73 set ownership for pvcs to mysql CRD. Kubernetes deletes the pvcs along with the CRD using its garbage cleaning design. The pods belonging to the statefulset created by CRD are not immediately terminated. Kubernetes pods have certain grace period before deletion. As a result, the PVCs get deleted first and pods later.
This works well on GKE, but causes issues on other implementations. E.g. I used it on a cluster with Datera storage provider. Datera seems to keep the volume information in the PVCs. When the PVC is deleted along with Mysql CRD, it looses that information. So when kubelet tries to delete the pod, the volume cannot be disconnected.
This fix creates a cleanup worker like reconcile worker in operator to wait till pods are deleted before deleting the corresponding pvcs.