feat(helm/raycluster): pass through annotations and podAnnotations (#962)#980
Conversation
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>
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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| labels: | ||
| model: {{ $modelSpec.name }} | ||
| helm-release-name: {{ .Release.Name }} | ||
| {{- include "chart.engineLabels" . | nindent 4 }} |
There was a problem hiding this comment.
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 }}| labels: | ||
| model: {{ $modelSpec.name }} | ||
| helm-release-name: {{ .Release.Name }} | ||
| {{- include "chart.engineLabels" . | nindent 10 }} |
There was a problem hiding this comment.
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 }}| labels: | ||
| model: {{ $modelSpec.name }} | ||
| helm-release-name: {{ .Release.Name }} | ||
| {{- include "chart.engineLabels" . | nindent 12 }} |
There was a problem hiding this comment.
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 }}50b1ecb to
23b7610
Compare
Summary
modelSpec.annotationsandmodelSpec.podAnnotationsalready exist and are honored for the standard (non-Ray) vLLMDeployment(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. Multusk8s.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 existingDeploymentpattern:modelSpec.annotations→RayClusterobjectmetadata.annotationsmodelSpec.podAnnotations→ head pod templatemetadata.annotationsmodelSpec.podAnnotations→ worker pod templatemetadata.annotationsNo 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-unittestcase tohelm/tests/ray-cluster_test.yamlasserting that bothannotations(object) andpodAnnotations(head + worker) render on the RayCluster.Closes #962
🤖 Generated with Claude Code