-
Notifications
You must be signed in to change notification settings - Fork 489
[Feature]: Add external-filter in Header for advanced routing #1804
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
Summary of ChangesHello @rayne-Li, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant enhancement to the gateway's routing capabilities by allowing advanced pod selection based on Kubernetes labels. A new Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces an external-filter header for advanced routing by filtering pods based on Kubernetes label selectors. The core logic is sound, but I have a few suggestions for improvement. The pod filtering can be optimized for better memory efficiency. The logging around the new filter can be made less verbose by logging only when a filter is actually provided. Most importantly, the unit test for this new feature is currently not testing the filtering logic correctly; I've provided a corrected version to ensure the feature is properly validated. Addressing these points will improve the performance, observability, and correctness of the new feature.
googs1025
left a comment
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.
@rayne-Li Thank you for your proposal, but I'm not entirely sure if this breaks the separation of concerns principle between the gateway and workload. 🤔 Could we achieve this separation at the workload level instead? Or could this be accomplished within the existing model.aibrix.ai/name labeling strategy? Additionally, with this filtering approach, will the target pod we obtain still be optimal?
@googs1025 As shown in the code: func (s *Server) selectTargetPod(ctx *types.RoutingContext, pods types.PodList, externalFilterExpr string) {
// incoming var: pods are all pod with exact model.name
// so this won't change whether the pods are the best choices
// FilterRoutablePods filters ready pods, so I extend that by adding an external filtering function
readyPods := utils.FilterRoutablePods(pods.All())
// ......
for _, p := range readyPods {
// filtering pod by externalFilter
}
}The pod filtering happens after utils.FilterRoutablePods (which only filters for ready pods), What I want is a common and pluggable filtering method that does not affect any existing routing-strategy logic and can be easily injected or bypassed. |
Signed-off-by: rayne-Li <[email protected]>
Signed-off-by: rayneLi <[email protected]>
a97b660 to
43ee93e
Compare
thanks for the detailed explanation. For now, this simple filtering is sufficient for routing. 😄 |
154a745 to
f812add
Compare
Signed-off-by: rayneLi <[email protected]>
f812add to
692eb0c
Compare
Signed-off-by: rayneLi <[email protected]> Signed-off-by: rayneLi <[email protected]>
googs1025
left a comment
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.
LGTM. thanks for your implement 😄
Pull Request Description
Add external-filter in Header for advanced routing
Related Issues
Resolves: #1803