-
Notifications
You must be signed in to change notification settings - Fork 142
feat :Add GetActivePods to handle/datastore and remove deleted pod from prefix-cache scorer #1376
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: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Kfir Toledo <[email protected]>
Signed-off-by: Kfir Toledo <[email protected]>
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kfirtoledo 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 |
Hi @kfirtoledo. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/assign @nirrozenbaum |
/hold |
@elevran is this aligned with the new datalayer APIs? |
I don't see a conflict - the datastore API is minimally affected. |
@@ -27,6 +29,9 @@ type Handle interface { | |||
Context() context.Context | |||
|
|||
HandlePlugins | |||
|
|||
// GetActivePods returns a list of all active pods | |||
GetActivePods() []types.NamespacedName |
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.
nit: In go, it's more idiomatic to use ActivePods
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.
Consider returning a map[types.NamespacedName]bool
instead of a list so the plugin doesn't need to convert a list to a map/set
@@ -61,6 +61,7 @@ type Datastore interface { | |||
PodList(predicate func(backendmetrics.PodMetrics) bool) []backendmetrics.PodMetrics | |||
PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool | |||
PodDelete(namespacedName types.NamespacedName) | |||
GetActivePods() []types.NamespacedName |
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.
No need to add this, we can use PodList
.
@@ -239,6 +248,45 @@ func (m *Plugin) matchLongestPrefix(ctx context.Context, hashes []BlockHash) map | |||
return res | |||
} | |||
|
|||
// StartPodActiveWatcher starts a goroutine that watches for active pods. | |||
func (m *Plugin) StartPodActiveWatcher(ctx context.Context, handle plugins.Handle) { |
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.
Can we call this something like CleanUpInactivePods
to be more descriptive?
ticker := time.NewTicker(PodActiveCheckInterval) | ||
defer ticker.Stop() | ||
|
||
podLastSeen := make(map[ServerID]time.Time) |
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 am thinking of a much simpler implementation: iterate over current pods in the podToLRU
in the indexer, and if that pod doesn't exist in ActivePods
, remove. And this approach does not need a PodInactivityTimeout
.
PR needs rebase. 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. |
This PR introduces two main enhancements:
These changes allow plugins to query active pods directly from the handle and support cache cleanup for inactive pods in the prefix-cache scorer (Fix #1289)