Skip to content

[FEAT][Helm] Add configurable NodePort support for router service#870

Open
ardecode wants to merge 2 commits intovllm-project:mainfrom
ardecode:feat/router-nodeport-config
Open

[FEAT][Helm] Add configurable NodePort support for router service#870
ardecode wants to merge 2 commits intovllm-project:mainfrom
ardecode:feat/router-nodeport-config

Conversation

@ardecode
Copy link
Contributor

@ardecode ardecode commented Mar 5, 2026

This PR adds support for pinning stable NodePort values in the router service,
addressing the issue where helm upgrade causes Kubernetes to reassign random
ports on each update.

Two new optional fields are added under routerSpec.nodePorts:

  • router: NodePort for the main router service port
  • lmcache: NodePort for the lmcache port (9000)

Both fields default to "", preserving existing behavior — if unset,
Kubernetes assigns ports randomly as before. The nodePort field is only
rendered in the Service manifest when serviceType is NodePort and an
explicit value is provided.

Fixes #763


  • 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].

Adds optional `routerSpec.nodePorts.router` and `routerSpec.nodePorts.lmcache`
fields to allow users to pin stable NodePort values across helm upgrades,
fixing the issue where Kubernetes would reassign random ports on each upgrade.

Closes vllm-project#763

Signed-off-by: ardecode <desaiarijit@gmail.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 enhances the Helm chart for the router service by introducing configurable NodePort assignments. This change aims to improve the stability and predictability of deployments by allowing users to define specific NodePorts for the router and lmcache services, thereby preventing Kubernetes from dynamically reassigning them during helm upgrade operations.

Highlights

  • Configurable NodePort Support: Introduced optional nodePorts configuration for the router service, allowing users to specify fixed NodePort values for the main router and lmcache ports.
  • Preventing Random Port Reassignment: Addressed the issue where helm upgrade would cause Kubernetes to reassign random NodePorts, ensuring stable service access across deployments.
  • Conditional NodePort Rendering: Implemented logic to only render the nodePort field in the Service manifest when serviceType is NodePort and an explicit value is provided, maintaining backward compatibility.

🧠 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
  • helm/templates/service-router.yaml
    • Added conditional nodePort fields for both the main router service port and the lmcache port.
    • Ensured nodePort is only applied when serviceType is NodePort and a value is explicitly set.
  • helm/values.yaml
    • Introduced a new nodePorts section within routerSpec.
    • Added router and lmcache fields under nodePorts, both defaulting to an empty string, allowing Kubernetes to assign ports if not specified.
Activity
  • The author has marked all pre-commit checks as passed.
  • The author has signed off their commit.
  • The author has classified the PR as [FEAT].
  • No human review comments or approvals have been recorded yet.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. 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

  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.

@ardecode
Copy link
Contributor Author

ardecode commented Mar 5, 2026

@ruizhang0101 , PR is ready for review!

Copy link
Contributor

@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 adds configurable NodePort support for the router service, which is a useful feature for ensuring stable network endpoints across Helm upgrades. The changes are logical and well-documented in values.yaml. I have added a couple of suggestions for the Helm template in service-router.yaml to improve its robustness by adopting a more standard templating pattern that better handles whitespace, thus preventing potential rendering issues.

Comment on lines +20 to +22
{{- if and (eq .Values.routerSpec.serviceType "NodePort") .Values.routerSpec.nodePorts.router }}
nodePort: {{ .Values.routerSpec.nodePorts.router }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current indentation of this conditional block can lead to extra newlines being rendered in the final YAML, which might cause parsing issues or unexpected formatting. A more robust and common pattern in Helm templates is to place the if/end control structures at the beginning of the line (with no indentation) and only indent the content within them. This approach provides better control over whitespace and improves template readability.

{{- if and (eq .Values.routerSpec.serviceType "NodePort") .Values.routerSpec.nodePorts.router }}
      nodePort: {{ .Values.routerSpec.nodePorts.router }}
{{- end }}

Comment on lines +27 to +29
{{- if and (eq .Values.routerSpec.serviceType "NodePort") .Values.routerSpec.nodePorts.lmcache }}
nodePort: {{ .Values.routerSpec.nodePorts.lmcache }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the previous comment, this conditional block's indentation could lead to unintended whitespace or newlines in the rendered YAML. Adopting the standard Helm practice of un-indented control structures will make the template more predictable and maintainable.

{{- if and (eq .Values.routerSpec.serviceType "NodePort") .Values.routerSpec.nodePorts.lmcache }}
      nodePort: {{ .Values.routerSpec.nodePorts.lmcache }}
{{- end }}

Copy link
Collaborator

@ruizhang0101 ruizhang0101 left a comment

Choose a reason for hiding this comment

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

LGTM :))) Thanks for the contribution!

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.

Add support for configurable NodePort router service and safe local overrides in Helm chart

2 participants