Skip to content

Conversation

zerofishnoodles
Copy link
Contributor

Fix lora operator compatibility with vllm runtime and vllm router.
Add shared pvc for lora.

BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE


  • Make sure the code changes pass the pre-commit checks.
  • Sign-off your commit by using -s when doing git commit
  • Try to classify PRs for easy understanding of the type of changes, such as [Bugfix], [Feat], and [CI].
Detailed Checklist (Click to Expand)

Thank you for your contribution to production-stack! Before submitting the pull request, please ensure the PR meets the following criteria. This helps us maintain the code quality and improve the efficiency of the review process.

PR Title and Classification

Please try to classify PRs for easy understanding of the type of changes. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:

  • [Bugfix] for bug fixes.
  • [CI/Build] for build or continuous integration improvements.
  • [Doc] for documentation fixes and improvements.
  • [Feat] for new features in the cluster (e.g., autoscaling, disaggregated prefill, etc.).
  • [Router] for changes to the vllm_router (e.g., routing algorithm, router observability, etc.).
  • [Misc] for PRs that do not fit the above categories. Please use this sparingly.

Note: If the PR spans more than one category, please include all relevant prefixes.

Code Quality

The PR need to meet the following code quality standards:

  • Pass all linter checks. Please use pre-commit to format your code. See README.md for installation.
  • The code need to be well-documented to ensure future contributors can easily understand the code.
  • Please include sufficient tests to ensure the change is stay correct and robust. This includes both unit tests and integration tests.

DCO and Signed-off-by

When contributing changes to this project, you must agree to the DCO. Commits must include a Signed-off-by: header which certifies agreement with the terms of the DCO.

Using -s with git commit will automatically add this header.

What to Expect for the Reviews

We aim to address all PRs in a timely manner. If no one reviews your PR within 5 days, please @-mention one of YuhanLiu11
, Shaoting-Feng or ApostaC.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @zerofishnoodles, 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 primarily focuses on enhancing the compatibility and functionality of LoRA (Low-Rank Adaptation) within the vLLM production stack on Kubernetes. It introduces shared persistent storage for LoRA adapters, configures vLLM runtimes to utilize these adapters, and updates the operator's capabilities and sample configurations to support a more robust LoRA deployment workflow, addressing compatibility issues with the vLLM runtime and router.

Highlights

  • Shared Persistent Storage for LoRA: Implemented a shared Persistent Volume (PV) and Persistent Volume Claim (PVC) to provide a common storage location for LoRA adapters, accessible by both the operator and vLLM runtime pods. This enables a centralized and persistent way to manage LoRA models.
  • LoRA Runtime Integration and Configuration: Configured vLLM runtime deployments to enable LoRA (enableLoRA: true) and allow dynamic runtime updating of LoRA models via the VLLM_ALLOW_RUNTIME_LORA_UPDATING environment variable, ensuring seamless integration with the LoRA operator.
  • Operator RBAC and Logic Enhancements: Updated the operator's RBAC permissions to manage persistentvolumeclaims, persistentvolumes, and ingresses. The vLLM runtime controller now includes reconciliation logic to automatically provision the shared PV/PVC if they don't exist, and both vLLM router and runtime controllers propagate all labels from their custom resources to the generated Deployments for improved resource management.
  • Updated Sample Configurations: Revised the example YAML manifests for LoraAdapter, VLLMRouter, and VLLMRuntime to demonstrate fetching LoRA adapters from Hugging Face (including a sample secret for credentials) and using model-specific labels (model=llama-3.1-8b-instruct) for routing, showcasing a complete LoRA deployment scenario.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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 or fill out our survey to provide feedback.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 fixes compatibility issues for the LoRA operator and adds support for a shared Persistent Volume Claim (PVC) to store LoRA adapters. The changes update the operator deployment, RBAC roles, and controllers to handle the shared storage. The sample configurations are also updated to reflect these new capabilities.

My review focuses on the new PV/PVC management logic. While the intent is good, the implementation has some critical issues:

  • The use of hostPath for a ReadWriteMany PV is not suitable for multi-node clusters.
  • The logic for creating the PV and PVC within the VLLMRuntime controller can lead to race conditions and will not work correctly in multi-namespace scenarios.
  • The controller code incorrectly attempts to use a namespace with cluster-scoped PersistentVolume resources.
  • There are also some minor issues like unnecessary RBAC permissions, a code style suggestion for better readability, and suggestions for improving comments and clarity in the sample configurations.

I've provided detailed comments and suggestions to address these points.

Comment on lines 188 to 192
return &corev1.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{
Name: "shared-pvc-storage",
Namespace: vllmRuntime.Namespace,
Labels: map[string]string{"app": vllmRuntime.Name},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

PersistentVolume is a cluster-scoped resource and cannot have a namespace. Setting Namespace: vllmRuntime.Namespace on the ObjectMeta of a PersistentVolume is incorrect and will cause an error when the controller tries to create it.

Please remove the Namespace field from the PersistentVolume's metadata.

ObjectMeta: metav1.ObjectMeta{
			Name:      "shared-pvc-storage",
			Labels:    map[string]string{"app": vllmRuntime.Name},
		},

Comment on lines 215 to 216
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteMany},
StorageClassName: &[]string{""}[0],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The expression &[]string{""}[0] to get a pointer to an empty string is valid but unconventional and can be difficult to read.

For better clarity and idiomatic Go, you can use new(string), which returns a pointer to a zero-valued string ("").

StorageClassName: new(string),

@zerofishnoodles zerofishnoodles force-pushed the feat/lora-operator branch 2 times, most recently from a71fbc7 to 0fe59a5 Compare July 23, 2025 20:19
Signed-off-by: Rui Zhang <[email protected]>
@zerofishnoodles zerofishnoodles marked this pull request as draft July 28, 2025 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant