[Feat][Operator] Add prefixaware and kvaware routing options to VLLMRouter CRD#881
Conversation
Summary of ChangesHello, 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 significantly enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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.
Code Review
This pull request correctly adds support for prefixaware and kvaware routing to the VLLMRouter CRD. The changes to the CRD definition, controller, and sample files are logical and well-structured. However, there is a significant issue that needs to be addressed: changes to the new lmcacheControllerPort field will not trigger a deployment update. This is because the deploymentNeedsUpdate function in vllmrouter_controller.go does not compare container arguments when checking for changes. This is an existing bug, but this PR makes it more impactful. I strongly recommend updating deploymentNeedsUpdate to compare dep.Spec.Template.Spec.Containers[0].Args to ensure configuration changes are correctly applied. I have also added a specific comment to improve the robustness of the argument handling.
| if router.Spec.LmcacheControllerPort != 0 { | ||
| args = append(args, "--lmcache-controller-port", fmt.Sprintf("%d", router.Spec.LmcacheControllerPort)) | ||
| } |
There was a problem hiding this comment.
To improve robustness and make the controller's behavior more explicit, it's better to only add the --lmcache-controller-port argument when the routingLogic is set to kvaware. This prevents passing a potentially unused argument to the router when other routing logics are selected.
| if router.Spec.LmcacheControllerPort != 0 { | |
| args = append(args, "--lmcache-controller-port", fmt.Sprintf("%d", router.Spec.LmcacheControllerPort)) | |
| } | |
| if router.Spec.RoutingLogic == "kvaware" && router.Spec.LmcacheControllerPort != 0 { | |
| args = append(args, "--lmcache-controller-port", fmt.Sprintf("%d", router.Spec.LmcacheControllerPort)) | |
| } |
…outer CRD Extend the VLLMRouter CRD to expose prefixaware and kvaware routing strategies, which were previously only reachable via the extraArgs escape hatch. Changes: - Add prefixaware and kvaware to the RoutingLogic enum in Go types and CRD YAML - Add LmcacheControllerPort field (default 9000) for kvaware routing - Only pass --lmcache-controller-port when routingLogic is kvaware - Add container args comparison to deploymentNeedsUpdate so routing config changes correctly trigger a deployment rollout - Update sample manifest comment to list all supported routing strategies Fixes vllm-project#862 Signed-off-by: Keyu Chen <54015474+keyuchen21@users.noreply.github.com>
a402b44 to
a75f0da
Compare
Summary
Fixes #862.
The
VLLMRouterCRD'sroutingLogicenum only allowedroundrobinandsession, even though the router binary also supportsprefixawareandkvaware. Users on CRD-based deployments (e.g. OpenShift) had to use theextraArgsescape hatch to access these modes.prefixawareandkvawareto theroutingLogicenum in the Go types and the generated CRD YAMLlmcacheControllerPortfield (default9000) for kvaware routing; the controller passes--lmcache-controller-portto the router container when setTest plan
make manifestsinoperator/regenerates the CRD YAML with the new enum values andlmcacheControllerPortfieldkubectl apply -f operator/config/crd/bases/applies cleanlyVLLMRouterwithroutingLogic: prefixawareis accepted by the API serverVLLMRouterwithroutingLogic: kvawareandlmcacheControllerPort: 9000is accepted and the router pod starts with--routing-logic kvaware --lmcache-controller-port 9000(verify viakubectl get deployment <name> -o yaml)