-
Notifications
You must be signed in to change notification settings - Fork 204
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
[BUG] Unexpected resource creation when the ZookeeperCluster is already deleted #410
Comments
@srteam2020 Could you please mention the steps of how you were able to reproduce the issue? |
@anishakj Thanks for your reply!
After the operator deleted the PVC (and removed the finalizer from CR), the CR is about to be deleted and there should be no further actions needed from the operator. However, we observed from the log that the operator actually created the zookeeper statefulset and service again even if the zookeepercluster CR is deleted. I think the root cause is that the operator does not directly return from |
@srteam2020 Would you like to create a PR to fix this? |
Yes I will try to create a PR to fix it |
Signed-off-by: Lipovsky, Tomas <[email protected]>
Signed-off-by: Lipovsky, Tomas <[email protected]>
Signed-off-by: Lipovsky, Tomas <[email protected]>
Description
We find that the zookeeper operator, after deleting the PVC and removing the finalizer for a ZookeeperCluster CR with a non-zero DeletionTimestamp (in reconcileFinalizers), will continue running the reconciliation logic if there is no error:
This can lead to unexpected resource creation, because after removing the finalizer of the CR, the CR is going to be deleted. When the CR is deleted, the resources (e.g., sts, service, secret, etc.) that are owned by the CR will also be deleted. If the operator does not immediately return after removing the finalizer, the original reconcile logic will find these resources do not exist and try to create these resources. For example, in reconcileStatefulSet the operator will create the zookeeper statefulset. Such creation is unexpected and unnecessary, as they will be deleted again since the owner CR does not exist.
Importance
should-have
Location
reconcileFinalizers
:https://github.com/srteam2020/zookeeper-operator/blob/a99c93ba06fbece2c262f7744517c2e537491c29/pkg/controller/zookeepercluster/zookeepercluster_controller.go#L664
Suggestions for an improvement
Instead of creating the resources that are destined to be deleted immediately, we should make the operator return from reconcile if the pvc is deleted successfully and the finalizer is removed from the CR successfully, as no further actions should be taken if the CR is deleted.
We are willing to send a PR to help fix it.
The text was updated successfully, but these errors were encountered: