Repository navigation
[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)) | |
| } |
a402b44 to
a75f0da
Compare
ruizhang0101
left a comment
There was a problem hiding this comment.
Hi, I am wondering have you tested it? Are prefixaware and kvaware working as expected?
|
@ruizhang0101 still working on it....once finished I will let you know |
76e3f53 to
6086e4c
Compare
…outer CRD - Extend RoutingLogic enum with prefixaware and kvaware strategies - Add LmcacheControllerPort field with maximum=65535 validation - Pass --lmcache-controller-port flag when routingLogic is kvaware and port is set - Add unit tests for routing logic and deployment update detection - Update CRD YAML, sample manifest, Helm values and README Signed-off-by: Keyu Chen <[email protected]>
6086e4c to
a8a0ea9
Compare
|
@dotmobo Do you have time to help me double check if all works ok? it seems ok for me...
|
|
hi seems good for me |
|
@ruizhang0101 looks ok now |
| | `routerSpec.containerPort` | integer | `8000` | Port the router container is listening on | | ||
| | `routerSpec.serviceType` | string | `"ClusterIP"` | Kubernetes service type for the router | | ||
| | `routerSpec.serviceAnnotations` | map | `{}` | Service annotations for LoadBalancer/NodePort | | ||
| | `routerSpec.nodePort` | integer | `-` | (Optional) Fixed NodePort for the router service when `serviceType` is `NodePort`. If unset, Kubernetes assigns a random port (30000-32767). | |
There was a problem hiding this comment.
Is this one still in use? If yes, could you add it back?
There was a problem hiding this comment.
@ruizhang0101 So routerSpec.nodePort never existed in the templates or schema. The router service template was created in PR #740 and it never included a nodePort field. It was only ever documented in the README — the documentation was wrong from the start.
There was a problem hiding this comment.
@keyuchen21 I didn't see the router service change in PR #740, but if it is confirmed that it is not being used, then it is good to remove it.
ruizhang0101
left a comment
There was a problem hiding this comment.
LGTM :)) Thanks for the contribution!
…outer CRD (vllm-project#881) - Extend RoutingLogic enum with prefixaware and kvaware strategies - Add LmcacheControllerPort field with maximum=65535 validation - Pass --lmcache-controller-port flag when routingLogic is kvaware and port is set - Add unit tests for routing logic and deployment update detection - Update CRD YAML, sample manifest, Helm values and README Signed-off-by: Keyu Chen <[email protected]> Co-authored-by: Rui Zhang <[email protected]> Signed-off-by: Ifta Khairul Alam Adil <[email protected]>





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 (default"") for kvaware routing; the controller passes--lmcache-controller-portto the router container only when explicitly sethelm/README.md: updateroutingLogicdescription, fixlmcacheControllerPorttype/default/description, fixkwawaretypoTest 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)helm templatewith default values does not emit--lmcache-controller-port; settingrouterSpec.lmcacheControllerPort=9000does emit it