Skip to content

Fix pd disaggreate port#46

Merged
iasthc merged 2 commits intomainfrom
fix/pd-disaggreate
Mar 23, 2026
Merged

Fix pd disaggreate port#46
iasthc merged 2 commits intomainfrom
fix/pd-disaggreate

Conversation

@george-wu20250203
Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist
Copy link
Copy Markdown

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 resolves an issue where the VLLM_NIXL_SIDE_CHANNEL_PORT was not being correctly exposed in Kubernetes deployments for vLLM containers. The changes introduce robust parsing of this port from environment variables and ensure its dynamic addition to the container's exposed ports, facilitating proper network communication for disaggregated vLLM components.

Highlights

  • VLLM Port Exposure: Implemented logic to dynamically expose the VLLM_NIXL_SIDE_CHANNEL_PORT in vLLM container definitions if specified via environment variables.
  • Pod Role Support: Ensured the VLLM_NIXL_SIDE_CHANNEL_PORT is correctly exposed for both decode and prefill vLLM pods.
  • Test Coverage: Added a new test case to validate that the VLLM_NIXL_SIDE_CHANNEL_PORT is properly configured and exposed in the generated Kubernetes deployments.
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.

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
Copy Markdown

@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 correctly implements the logic to expose the VLLM_NIXL_SIDE_CHANNEL_PORT from the environment variables to the container ports for both decode and prefill pods. The accompanying tests validate this new functionality. I've added two review comments with suggestions to improve code maintainability by replacing a magic string with a constant and refactoring duplicated test code.

// container port for both decode and prefill pods.
var nixlPort int32
for _, e := range ms.Spec.Engine.Env {
if e.Name == "VLLM_NIXL_SIDE_CHANNEL_PORT" {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The string literal "VLLM_NIXL_SIDE_CHANNEL_PORT" is a magic string. It's also used in the test file. To improve maintainability and avoid potential typos, it's recommended to define this as a package-level constant. For example: const vllmNixlSideChannelPortEnv = "VLLM_NIXL_SIDE_CHANNEL_PORT".

Comment on lines +174 to +205
It("should expose VLLM_NIXL_SIDE_CHANNEL_PORT on vLLM container for decode and prefill", func() {
ms := newTestModelService()
expected := int32(6123)
ms.Spec.Engine.Env = append(ms.Spec.Engine.Env, corev1.EnvVar{
Name: "VLLM_NIXL_SIDE_CHANNEL_PORT",
Value: "6123",
})

role := &ms.Spec.Decode

decodeDep := BuildDeployment(ms, role, RoleDecode, "test-decode", nil, nil, nil, TracingConfig{}, testKitImage)
decodeVLLM := decodeDep.Spec.Template.Spec.Containers[0]
var foundDecode bool
for _, p := range decodeVLLM.Ports {
if p.ContainerPort == expected && p.Protocol == corev1.ProtocolTCP {
foundDecode = true
break
}
}
Expect(foundDecode).To(BeTrue(), "Decode vLLM should expose VLLM_NIXL_SIDE_CHANNEL_PORT")

prefillDep := BuildDeployment(ms, role, RolePrefill, "test-prefill", nil, nil, nil, TracingConfig{}, testKitImage)
prefillVLLM := prefillDep.Spec.Template.Spec.Containers[0]
var foundPrefill bool
for _, p := range prefillVLLM.Ports {
if p.ContainerPort == expected && p.Protocol == corev1.ProtocolTCP {
foundPrefill = true
break
}
}
Expect(foundPrefill).To(BeTrue(), "Prefill vLLM should expose VLLM_NIXL_SIDE_CHANNEL_PORT")
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This test case contains duplicated logic for checking the 'decode' and 'prefill' roles. To make the test more concise and maintainable, consider refactoring it to use Ginkgo's DescribeTable to test both roles with a single, data-driven test implementation.

 	DescribeTable("should expose VLLM_NIXL_SIDE_CHANNEL_PORT on vLLM container for decode and prefill",
		func(roleType, roleName, roleDisplayName string) {
			ms := newTestModelService()
			expected := int32(6123)
			ms.Spec.Engine.Env = append(ms.Spec.Engine.Env, corev1.EnvVar{
				Name:  "VLLM_NIXL_SIDE_CHANNEL_PORT",
				Value: "6123",
			})

			role := &ms.Spec.Decode

			dep := BuildDeployment(ms, role, roleType, "test-"+roleName, nil, nil, nil, TracingConfig{}, testKitImage)
			vllmContainer := dep.Spec.Template.Spec.Containers[0]
			var found bool
			for _, p := range vllmContainer.Ports {
				if p.ContainerPort == expected && p.Protocol == corev1.ProtocolTCP {
					found = true
					break
				}
			}
			Expect(found).To(BeTrue(), "%s vLLM should expose VLLM_NIXL_SIDE_CHANNEL_PORT", roleDisplayName)
		},
		Entry("for decode role", RoleDecode, "decode", "Decode"),
		Entry("for prefill role", RolePrefill, "prefill", "Prefill"),
	)

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/modelservice/deployment.go 85.00% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@iasthc iasthc merged commit f867295 into main Mar 23, 2026
12 checks passed
@iasthc iasthc deleted the fix/pd-disaggreate branch March 23, 2026 04:41
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.

2 participants