-
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
Informer caching and event propagation #4077
Comments
Splitting off a new issue now that the pr has been resolved. Taking a step back, my thought with the ReducedStateItemStore, is that application assumes the responsibility for maintaining a resource cache - referred to in other places as a fronting cache. For example modifying the operator sdk TemporaryResourceCache and keeping with the assumption of optimistically locked updates we have:
That I believe should maintain a customizable Temporary/Temporal cache - without modifying the store. But it doesn't address the concern raised in the issue - that you don't want to not consume local events. If you try to update the store - with some additional assumptions, such as not using the informer for indexing, resync being disabled or at least sync events being filtered, and adding new ItemStore/ReducedStateItemStore methods you'd have:
If you directly call putUpdatedResource(resource, version, false) and that successfully modifies the store, then no event will be emitted when the informer consumes the update event from the api server as it will appear to be a sync event (no change in resource version). However this introduces the problem that if the application moves ahead by more than 1 update, then the event processing will not be correct - that is: putUpdatedResource(resource, version, false); So either you need to further prevent that case, or I think you'd have to move application level event handling into the ResourceCache construct - such that it knows to make updates based upon cache state. However that seems inelegant given that it duplicates event processing that is already in the informer. @lburgazzoli @metacosm @csviri is this inline with everyone's thoughts? And what if anything would be good to add in 6.0 to aid in your usage of the informer? |
@shawkins so regarding this, as I mentioned in the comment:
The current implementation is basically based on a quite complex code (unfortunately), but this was the only way I found that is correct (not claiming there is not simpler solution but all simpler variations I tried had some flaws). And the current solution mainly makes sense for us because we have a higher level abstraction, called Dependent Resources . So all the necessary call made for the The idea of the current solution is that if we know there will be a create or update operation we notify Note the After the update is done, we again call the (It event more complex because it has to play well with the So this is not ideal, and was thinking if adding this code (with such complexity) is "worth it", but at the end it solved this problem in the issue. We kinda considering this experimental, it is tested fairly in detail with unit and integration tests, and no issues with it until now. We can dive deeper if needed. |
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions! |
Removed the never stale to see if we can move this towards a resolution. It's not clear to me yet what belongs down in the fabric8 client for this. One minor thing I do see in the go client is the notion of a filtering event handler. That looks to be a pretty straightforward class that has tests for the old and new object to see if the event should be passed along. |
there are filters for such events in JOSDK on top of Informer in fabric8. But, might be interesting to put it into fabric8 directly. We can discuss the event propagation filtering on the weekly meeting. But might be just stick with this inside JOSDK. |
I can also see that it would be pretty straight-forward to have event handler that omits locally generated events, but I'm not sure how common place that need is or if that would seen as needing to be coupled with cache mutations. For that there is also a mutation_cache construct in the go client, but it's based upon an assumption about resourceVersion format/ordering - that puts the onus on the user to understand that might not always work. As far as I can tell there's no way around that with cache mutations - you have to be able to tell what's latest to be consistent. |
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions! |
There is one more feature that we support, is to not propagate the event that was a result of our update. Like if I update an ingress for example in the reconciler and I have an informer registered for this ingress. There we will not propagate event for this update by the informer ( InformerEventSource). So no additional reconciliation will happen on our own update. This would make sense probably to put into informer, the problem is that it is quite complex code, and also from the users perspective.
We can go into details in an other issue maybe. If there is a consensus that this might be useful in general.
Originally posted by @csviri in #3943 (comment)
The text was updated successfully, but these errors were encountered: