-
Notifications
You must be signed in to change notification settings - Fork 40.9k
KEP-5229: Implement API dispatcher #132523
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
base: master
Are you sure you want to change the base?
Conversation
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/hold |
/cc @sanposhiho @dom4ha This PR is not yet completed but the discussion could start. |
f9f67a7
to
31f084d
Compare
Are we 100% sure this doesn't need a changelog entry? I think it's useful to changelog this PR in its own right. |
Yes, it needs an entry. I'll add it when the PR won't be WIP. |
31f084d
to
f844906
Compare
f844906
to
b1caf2d
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: macsko The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
b1caf2d
to
153b9e8
Compare
153b9e8
to
99fb477
Compare
99fb477
to
e524109
Compare
// removeFromQueue removes the objectUID from the queue and returns the recreated queue. | ||
func removeFromQueue(queue *buffer.Ring[types.UID], objectUID types.UID) *buffer.Ring[types.UID] { | ||
newQueue := buffer.NewRing[types.UID](buffer.RingOptions{ | ||
InitialSize: queue.Len(), | ||
NormalSize: queue.Cap(), | ||
}) | ||
for { | ||
uid, ok := queue.ReadOne() | ||
if !ok { | ||
break | ||
} | ||
if uid != objectUID { | ||
newQueue.WriteOne(uid) | ||
} | ||
} | ||
return newQueue | ||
} |
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 choice of data structure for the queue involves a trade-off based on these requirements:
- Fast, FIFO-ordered inserts and pops.
- Efficient removal of an occasional item from the middle of the queue.
We have a few options:
- Queue based on slice (buffer.Ring): Offers the best performance for standard FIFO operations. But, removing an element from the middle requires recreating (in buffer.Ring) or shifting (if we do our own) the underlying slice.
- Linked list ( container/list): Provides efficient deletion from the middle of the queue. But, standard push/pop operations have lower performance.
- Something other?
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR adds an
APIDispatcher
component that will be responsible for queueing and asynchronous execution of API calls during scheduling. This component could be then connected to scheduler's cache or used directly, if needed.This PR focuses on adding the dispatcher. Further PRs will connect the dispatcher to scheduler and make use of it.
Customizability is achieved by using
APICall
interface that could be implemented in any way.apiCallRelevances
passed to the dispatcher's constructor will allow to set any relevance hierarchy.Which issue(s) this PR is related to:
Fixes: #132489
KEP: kubernetes/enhancements#5229
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: