Skip to content

feat(helm/raycluster): pass through annotations and podAnnotations (#962)#980

Merged
ruizhang0101 merged 2 commits into
vllm-project:mainfrom
Anai-Guo:feat/raycluster-annotations
Jun 22, 2026
Merged

feat(helm/raycluster): pass through annotations and podAnnotations (#962)#980
ruizhang0101 merged 2 commits into
vllm-project:mainfrom
Anai-Guo:feat/raycluster-annotations

Conversation

@Anai-Guo

Copy link
Copy Markdown
Contributor

Summary

modelSpec.annotations and modelSpec.podAnnotations already exist and are honored for the standard (non-Ray) vLLM Deployment (deployment-vllm-multi.yaml), but the RayCluster template never consumed them. Users running engines through KubeRay (raySpec.enabled: true) therefore had no way to attach pod-level annotations — e.g. Multus k8s.v1.cni.cncf.io/networks — or object-level annotations to their head/worker pods. As #962 notes, the values appear to exist but were simply never wired into the kuberay path.

Changes

helm/templates/ray-cluster.yaml, mirroring the existing Deployment pattern:

  • modelSpec.annotationsRayCluster object metadata.annotations
  • modelSpec.podAnnotations → head pod template metadata.annotations
  • modelSpec.podAnnotations → worker pod template metadata.annotations

No new values are introduced — this only completes the existing passthrough for the KubeRay path. Both blocks are guarded with {{- with ... }}, so output is unchanged when the values are empty (the default).

Test

Adds a helm-unittest case to helm/tests/ray-cluster_test.yaml asserting that both annotations (object) and podAnnotations (head + worker) render on the RayCluster.

Closes #962

🤖 Generated with Claude Code

The `annotations` and `podAnnotations` values already exist on
`modelSpec` and are wired into the standard (non-Ray) vLLM Deployment
via `deployment-vllm-multi.yaml`, but the RayCluster template never
consumed them. As a result, users running engines through KubeRay had
no way to attach pod-level annotations (e.g. Multus
`k8s.v1.cni.cncf.io/networks`) or object-level annotations to their
head/worker pods.

Mirror the Deployment pattern in `ray-cluster.yaml`:
- `modelSpec.annotations` -> RayCluster object metadata
- `modelSpec.podAnnotations` -> head and worker pod template metadata

No new values are introduced; this only completes the existing
passthrough for the KubeRay path. Adds a helm-unittest case asserting
both annotation kinds render on the RayCluster.

Closes vllm-project#962

Signed-off-by: Tai An <antai12232931@outlook.com>

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

Copy link
Copy Markdown
Contributor

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 support for custom annotations and podAnnotations in the RayCluster Helm template, along with corresponding unit tests. The review feedback suggests correcting the JSONPath syntax in the new unit tests to avoid parsing failures. Additionally, it recommends extending the metadata passthrough by supporting custom labels and podLabels on the RayCluster and its pod templates to ensure feature parity with standard Deployment templates.

Comment thread helm/tests/ray-cluster_test.yaml Outdated
Comment on lines +210 to +220
equal:
path: metadata.annotations.["example.com/owner"]
value: team-a
- documentIndex: 0
equal:
path: spec.headGroupSpec.template.metadata.annotations.["k8s.v1.cni.cncf.io/networks"]
value: macvlan-conf
- documentIndex: 0
equal:
path: spec.workerGroupSpecs[0].template.metadata.annotations.["k8s.v1.cni.cncf.io/networks"]
value: macvlan-conf

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In helm-unittest (and standard JSONPath), the dot before the bracket notation (e.g., .["..."]) is syntactically incorrect and can cause path parsing failures. It should be written as ["..."] directly appended to the parent field.

      equal:
        path: metadata.annotations["example.com/owner"]
        value: team-a
    - documentIndex: 0
      equal:
        path: spec.headGroupSpec.template.metadata.annotations["k8s.v1.cni.cncf.io/networks"]
        value: macvlan-conf
    - documentIndex: 0
      equal:
        path: spec.workerGroupSpecs[0].template.metadata.annotations["k8s.v1.cni.cncf.io/networks"]
        value: macvlan-conf

Comment thread helm/templates/ray-cluster.yaml Outdated
Comment on lines +16 to +19
labels:
model: {{ $modelSpec.name }}
helm-release-name: {{ .Release.Name }}
{{- include "chart.engineLabels" . | nindent 4 }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To ensure feature parity with the standard Deployment template and complete the metadata passthrough for KubeRay, we should also pass through modelSpec.labels to the RayCluster metadata.

  labels:
    model: {{ $modelSpec.name }}
    helm-release-name: {{ .Release.Name }}
    {{- include "chart.engineLabels" . | nindent 4 }}
    {{- with $modelSpec.labels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}

Comment thread helm/templates/ray-cluster.yaml Outdated
Comment on lines +31 to +34
labels:
model: {{ $modelSpec.name }}
helm-release-name: {{ .Release.Name }}
{{- include "chart.engineLabels" . | nindent 10 }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To ensure feature parity with the standard Deployment template and complete the metadata passthrough for KubeRay, we should also pass through modelSpec.podLabels to the head pod template metadata.

        labels:
          model: {{ $modelSpec.name }}
          helm-release-name: {{ .Release.Name }}
          {{- include "chart.engineLabels" . | nindent 10 }}
          {{- with $modelSpec.podLabels }}
          {{- toYaml . | nindent 10 }}
          {{- end }}

Comment thread helm/templates/ray-cluster.yaml Outdated
Comment on lines +290 to +293
labels:
model: {{ $modelSpec.name }}
helm-release-name: {{ .Release.Name }}
{{- include "chart.engineLabels" . | nindent 12 }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To ensure feature parity with the standard Deployment template and complete the metadata passthrough for KubeRay, we should also pass through modelSpec.podLabels to the worker pod template metadata.

          labels:
            model: {{ $modelSpec.name }}
            helm-release-name: {{ .Release.Name }}
            {{- include "chart.engineLabels" . | nindent 12 }}
            {{- with $modelSpec.podLabels }}
            {{- toYaml . | nindent 12 }}
            {{- end }}

@Anai-Guo Anai-Guo force-pushed the feat/raycluster-annotations branch from 50b1ecb to 23b7610 Compare June 21, 2026 19:15
@ruizhang0101 ruizhang0101 enabled auto-merge (squash) June 22, 2026 20:50

@ruizhang0101 ruizhang0101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@ruizhang0101 ruizhang0101 merged commit a16f60f into vllm-project:main Jun 22, 2026
7 of 8 checks passed
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.

feature: Support adding modelSpec pod annotations to ray-cluster spec.

2 participants