-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Get deleted object from work queue #297
Comments
I'm also waiting for the answer! |
The queue just stores the key (typically namespace/name) of the object that changed in a way that needs to be processed. The workqueue should take the absence of the object in the store/indexer to mean the object doesn't exist and should be removed. If you need the object, hook in at the DeleteFunc level to temporarily store the deleted object for use but be aware it is not always available (if your watch drops and gets reestablished right at deletion time you might not have the final version of the object available, or if your controller is down while an object is created and then deleted, you won't ever know it existed) |
Thank @liggitt @munnerz . I have used a separate indexer to keep track of deleted items. Here is what my modification looks like https://github.com/tamalsaha/workqueue-demo/pull/1/files . If you have any comments, please let me know in the pr. |
We are in the process of using workqueue for our various controllers. One of the issue I see is that dequeue from workqueue does not return the object (it is nil). I understand the idea that the desired state by user is
nil
, after an object is deleted. But there are cases where we need access to the metadata/spec on the object. One work around I have found is to register my controller as a finalizer so I can get the object in the UpdateFunc(). One issue with finalizers is that someone can remove them by mistake. Can WorkQueue return deleted objects?client-go/examples/workqueue/main.go
Lines 69 to 88 in c6f8cf2
The text was updated successfully, but these errors were encountered: