-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 resync option to manager options #88
Conversation
/kind feature |
I think this looks reasonable, but we should probably have some comment on when it's appropriate to override this setting. |
Sure, though I'm not sure what that comment should be. It should also mention why 10 hours is an appropriate default. It's hard to come by this knowledge since informers are not very well documented. 😄 Examples of resync periods in Kubernetes: |
I changed the name of the field to |
Unrelated to this PR, but this line references That caused issues for me locally. |
@grantr Can you pl. squash the commits.
Thats strange, how is that compiling. |
Whats the issue you are seeing ? log is declared in |
Interesting. My editor (Atom) runs |
Allows setting the resync interval to something besides the default of 10 hours for all informers managed by the cache.
Rebased @droot! |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: grantr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I think we might want to reword that description -- from my understanding, I think it's a bit misleading. You really only need a resync interval at all if one of the stimuli you react to isn't watchable -- it needs to be polled (e.g. the HPA, which needs to poll metrics for changes). Historically, from what I understand, it was also used to prevent accidental "misses" of events or reconciles, but that's not true any more, from what I've been told. |
How was this fixed? |
For the API server events, I think the code was made sufficiently robust that watch event misses were no longer an issue. I wanted to make sure my recollection about resyncing from cache was correct, so I traced things through. If you look at what resync actually does these days, we see that it determines To summarize, basically, it runs through the cache every resync interval, adding an event to trigger a reconcile, so it's completely independent of apiserver communication. Thus it, it seems like it only becomes relevant if either a) you've miswritten your reconcile loop so that it can fail to reconcile the correct state and not cause a requeue |
Ok, that clarifies things, thanks! Just to make sure I understand, here's what I interpret as the reasons to want a resync interval:
This seems complex enough that it seems like it should be an article in the kubebuilder book, and the comment in code should link to that article. WDYT @DirectXMan12? |
It should never be kube code (famous last words)
Use the channel event source + client(cache).List. It's not necessarily more efficient or anything, but is more flexible (since you can filter what you relist, if you want, or do more complicated logic)
I don't know if we actual configure the max backoff anywhere. I think right now it's abnormally large. @pwittrock and I were talking about this the other day. I also haven't fully proven this case to myself -- I'd need to test or follow the code through a bit more
We should probably talk about it, yes. In general, I think users probably shouldn't bother changing the default unless they really know what they're doing. |
Maybe that should be the comment 😁 |
heh, that's fair. I'd want to leave a little bit of description, but sticking that at the end is probably fine :-) |
Add a resync option to manager options
The comment tries to capture more of the thoughts exchanged in kubernetes-sigs#88.
The comment tries to capture more of the thoughts exchanged in kubernetes-sigs#88.
The comment tries to capture more of the thoughts exchanged in kubernetes-sigs#88.
* Improve docs for manager.Options.SyncPeriod The comment tries to capture more of the thoughts exchanged in #88. * Note that SyncPeriod applies to all controllers. Co-authored-by: Joe Julian <me@joejulian.name> * Make explanation of SyncPeriod more precise.. Co-authored-by: Joe Julian <me@joejulian.name> Co-authored-by: Joe Julian <me@joejulian.name>
* Improve docs for manager.Options.SyncPeriod The comment tries to capture more of the thoughts exchanged in kubernetes-sigs#88. * Note that SyncPeriod applies to all controllers. Co-authored-by: Joe Julian <me@joejulian.name> * Make explanation of SyncPeriod more precise.. Co-authored-by: Joe Julian <me@joejulian.name> Co-authored-by: Joe Julian <me@joejulian.name>
Allows setting the resync interval to something besides the default of 10 hours for all informers managed by the cache.
I'm not sure how to test this, because the resync interval seems to be irretrievable from the cache or its informers.
Fixes #87.