Skip to content
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

Add a construct in between a Watch and an Informer #3587

Closed
shawkins opened this issue Nov 12, 2021 · 2 comments · Fixed by #3943
Closed

Add a construct in between a Watch and an Informer #3587

shawkins opened this issue Nov 12, 2021 · 2 comments · Fixed by #3943
Milestone

Comments

@shawkins
Copy link
Contributor

The fabric8 built-in watch support is similar to a retrywatcher in the go client - until http gone it will maintain the watch automatically. Because the watch is restarted at an exact resourceVersion, there are no duplicate add events.

The next option is to use an informer, but in some circumstances there may be a concern about the size of an informer cache. Either we need to offer additional cache customization features - similar to #3472 - or introduce a further enhanced watch construct that goes beyond the retry to handle http gone. Under the covers this would look like an informer that caches only the resource key and version, but the user would still use the Watcher interface.

@shawkins
Copy link
Contributor Author

shawkins commented Nov 12, 2021

The only issue is that there is no way currently to retrieve just a list of the identifiers and resource versions to process the removals after a "relist". You would still end up pulling the entire list into memory, albeit for a small amount of time.

About the only thing I can think of is to implement the relist using limit/continue to keep the memory footprint controllable.

shawkins added a commit to shawkins/kubernetes-client that referenced this issue Nov 24, 2021
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Nov 24, 2021
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 15, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 15, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 15, 2022
@shawkins
Copy link
Contributor Author

shawkins commented Jan 17, 2022

Ostensibly this work is being done for operator scaling. The work in #3587 adds the underlying mechanics for batch fetching. There is also some discussion on alternative approaches, such as sharding - #3753 (comment) - that don't involve further changes to the informer framework.

I should add that while possible, a sharding approach seems fairly invasive / difficult - you'd need a good hashing function wrt the number of statefulset replicas, transitively set the necessary index label to dependent resources, and create/deletes would need special handling. Presuming that you are using sharding to avoid a single large process you could not simply use an informer in the coordinating operator to keep the index label up-to-date - you'd have to use a periodic paginated reconciliation (possibly with a watch). If you ever needed to modify the replica count (or need to be defensive to any modification), the index can be changed - which would be seen as a delete event by informers looking for that label value. So there would need to be an additional lookup or other mechanism to establish the difference between a changed index, and a full deletion.

manusa pushed a commit to shawkins/kubernetes-client that referenced this issue Jan 20, 2022
@manusa manusa closed this as completed in 36d6731 Jan 20, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Mar 7, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Mar 7, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Mar 7, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Apr 3, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Apr 3, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Apr 3, 2022
@manusa manusa linked a pull request Apr 12, 2022 that will close this issue
11 tasks
@manusa manusa added this to the 6.0.0 milestone Apr 12, 2022
manusa pushed a commit to shawkins/kubernetes-client that referenced this issue Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants