-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
storage/cacher: waitUntilWatchCacheFreshAndForceAllEvents checks if storage.RequestWatchProgress is supported #124867
Conversation
…torage.RequestWatchProgress is supported
/assign @wojtek-t |
// | ||
// In this very rare scenario, the worst case will be that this | ||
// request will wait for 3 seconds before it fails. | ||
if etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RequestWatchProgress) && c.watchCache.notFresh(requestedWatchRV) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will also open a separate pr for rejecting a watch-list request when the feature is not supported by the underlying store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p0lyn0mial trying to grasp this better, please correct me if I'm misunderstanding here and I'm pretty sure this is a pathological scenario, but as I understand it, if Supports
returns true
, it can also mean that another client can have it disabled. So the worst case as you mentioned here is the request would wait for 3 seconds (blockTimeout
) and then fail.
However, if the condition ends up being true
, we would call waitingUntilFresh.Add()
, which according to:
kubernetes/staging/src/k8s.io/apiserver/pkg/storage/cacher/watch_progress.go
Lines 98 to 102 in 06c9cdc
shouldRequest := func() bool { | |
pr.mux.RLock() | |
defer pr.mux.RUnlock() | |
return pr.waiting > 0 && !pr.stopped | |
}() |
means we would request a progress notify from etcd. And this is requested every 100ms:
progressRequestPeriod = 100 * time.Millisecond |
So if the worst case scenario happens and we wait for 3 seconds, its also possible that we send 30 progress notify requests to etcd in that time period for every such request that comes in. Considering this is rare, I guess this isn't too much additional load, but considering this can happen for each such request, do you think its possible for this to behave in unintentional ways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scenario you described can happen when the api-server is configured to use multiple etcd clusters (in theory, this is possible), and these etcd clusters run on different versions. I was also concerned about this design. After talking with @wojtek-t , I realised this is an extremely exotic scenario, not really seen in practice.
I could see an optimisation where the progress notifier could also read the state of the feature before sending a request to etcd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p0lyn0mial that makes sense. Trying something here based on your suggestion: #124928
PTAL 🙏🏼
Since Wojtek is already assigned I'm triaging this one. |
/lgtm |
LGTM label has been added. Git tree hash: 0aa381e8e5150bcefb719c215576e14aa755801f
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: p0lyn0mial, wojtek-t 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 |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: