-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Unable to remove finalizer on custom resource #2302
Comments
Relates to #2292 |
I think this issue should get fixed by #2372 (since we not do create() first and then get()/replace() afterwards as a fallback). I tried it out with a simple
I tried removing one finalized "demo.fabric8.io" using
When I ran this code, I was able to see finalized being removed:
|
Closing this issue. But feel free to reopen in case you face any problems :-) |
When implementing a controller that registers a finalizer, then it is supposed to do any necessary cleanup when it gets a MODIFIED event where the deletionTimestamp is set - see https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-deletion
When I remove my finalizer, I need to delete it from the list of finalizers and update the resource and only when all finalizers are removed, the resource is actually deleted.
If I make my change on the current resource and invoke 'createOrReplace' then I get an exception with 'resourceVersion should not be set on objects to be created' because the createOrReplace (io.fabric8.kubernetes.client.dsl.base.BaseOperation#createOrReplace) first tries to reload the object from the server, but as it is being deleted it gets nothing and therefore tries to create the object.
resource.getMetadata().getFinalizers().remove(FINALIZER_NAME);
customResourceClient.crClient.createOrReplace(resource);
For finalizers I need some way of updating (or patching) the resource withouth first reloading it from server. I also tried listening for the DELETE event in a mutating webhook, but on a delete I am not allowed to patch the resource from the webhook when it is being deleted.
The text was updated successfully, but these errors were encountered: