-
Notifications
You must be signed in to change notification settings - Fork 198
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
Adding a finalizer on a kafkatopics.kafka.banzaicloud.io doesn't prevent the deletion #953
Comments
Dear @cmeichel-scality! We will inform you soon about our opinion with possible solutions. |
Hey @cmeichel-scality, Apologies for the delay in the response. Theoretical points on building hierarchy/codependency in finalizers:The finalizers set on the CR are a mechanism to make the K8s deletion of the CR wait until the finalizers' controllers clean the - possibly unmanaged/formally-unowned - related resources up and perform more complex cleanups than cascadic deletion of resources based on the This is the mechanism we use to make sure to clean up the topic-in-Kafka when their associated KafkaTopic CRs are deleted, using the corresponding Koperator To summarize, the finalizers are there to prevent the deletion of the CR before the complex or unmanaged derived resources would be deleted. The operator pattern practices we are used to throughout the industry manage the finalizers independently from each other - even Red Hat's operator best practices states
Practical aspects of handling your problematic caseFortunately Koperator has the ability to express and control the ownership of the topic-in-Kafka related to the KafkaTopic CR. With that in mind the following procedure could give you the resulting behavior you are seeking to my understanding:
This is what we have today. Improvement ideas:We also contemplated what you were suggesting about having some kind of hierarchy or defer mechanism in the finalizers logic so it can be signaled to Koperator that its We don't have control over the order of controllers on finalizers executed other than how the Koperator's We could technically implement an artifical blocking wait in Koperator's Because of the cons of that approach we tried to find a middle-ground that wouldn't disrupt normal usage while giving mechanisms to achieve the functionality you are seeking and came up with the idea of implementing either a special
This requires a minor feature implementation to work and the introduction of a new annotation (value at least) that we need to design to be easily extensible if we want to move further with the sophistication of ownership handling which needs a bit of a think-through on our end. Also however simple the solution might be, it would still be added complexity to the operator so we would only take upon this path if there is both a strong need for the functionality for you (the current procedure not being satisfactory) and this use-case (wanting to defer topic-in-Kafka deletion while not taking full ownership of it) and its better handling being more prominent to the wider community. We would like to hear feedback from you on these points we shared while we will try to gather opinions from the community in the near future on this matter. Readers of this issue, feel free to react/comment your opinions. Edit: typo |
Describe the bug
Adding a
finalizer
on akafkatopics.kafka.banzaicloud.io
doesn't prevent the deletionSteps to reproduce the issue:
my-cluster
topic.yaml
kubectl apply -f topic.yaml
kubeclt delete
:kubeclt delete kafkatopics.kafka.banzaicloud.io my-topic
kubectl describe kafkatopics.kafka.banzaicloud.io my-topic
=> still thereExpected behavior
If user add a custom
finalizer
, the topic in kafka should not be deleted. Basically, the topic cannot be deleted since there is stillfinalizers
thanfinalizer.kafkatopics.kafka.banzaicloud.io
Screenshots
NA
Additional context
Basically, the following line (https://github.com/banzaicloud/koperator/blob/master/controllers/kafkatopic_controller.go#L226):
should be
The text was updated successfully, but these errors were encountered: