-
Notifications
You must be signed in to change notification settings - Fork 428
[Feat][Helm] Support customizable resources and init containers for RayCluster #992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,51 @@ spec: | |
| securityContext: | ||
| {{- toYaml . | nindent 10 }} | ||
| {{- end }} | ||
| {{- if and (hasKey $modelSpec "raySpec") (hasKey $modelSpec.raySpec "headNode") (hasKey $modelSpec.raySpec.headNode "initContainer") }} | ||
| {{- $container := $modelSpec.raySpec.headNode.initContainer }} | ||
| initContainers: | ||
| - name: {{ $container.name }} | ||
| image: {{ $container.image }} | ||
| {{- if $container.command }} | ||
| command: {{ toYaml $container.command | nindent 14 }} | ||
| {{- end }} | ||
| {{- if $container.args }} | ||
| args: {{ toYaml $container.args | nindent 14 }} | ||
| {{- end }} | ||
| {{- if $modelSpec.envFromSecret }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| envFrom: | ||
| - secretRef: | ||
| name: {{ $modelSpec.envFromSecret.name }} | ||
| {{- end }} | ||
| env: | ||
| - name: RELEASE_NAME | ||
| value: {{ .Release.Name }} | ||
| {{- if and .Values.cacheserverSpec.enabled .Values.cacheserverSpec.servicePort }} | ||
| - name: LMCACHE_SERVER_SERVICE_PORT | ||
| value: {{ .Values.cacheserverSpec.servicePort | quote }} | ||
| {{- end }} | ||
| {{- if $container.env }} | ||
| {{- toYaml $container.env | nindent 14 }} | ||
| {{- end }} | ||
| {{- if $container.resources }} | ||
| resources: {{ toYaml $container.resources | nindent 14 }} | ||
| {{- end }} | ||
| {{- $pvcMountEnabled := and (hasKey $container "mountPvcStorage") $container.mountPvcStorage (hasKey $modelSpec "pvcStorage") }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can simplify the {{- $pvcMountEnabled := and $container.mountPvcStorage $modelSpec.pvcStorage }} |
||
| {{- if or $pvcMountEnabled $container.extraVolumeMounts }} | ||
| volumeMounts: | ||
| {{- if $pvcMountEnabled }} | ||
| - name: {{ .Release.Name }}-storage | ||
| mountPath: /data | ||
| {{- end }} | ||
| {{- with $container.extraVolumeMounts }} | ||
| {{- toYaml . | nindent 14 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.servingEngineSpec.containerSecurityContext }} | ||
| securityContext: | ||
| {{- toYaml .Values.servingEngineSpec.containerSecurityContext | nindent 14 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| containers: | ||
| - name: vllm-ray-head | ||
| image: "{{ required "Required value 'modelSpec.repository' must be defined !" $modelSpec.repository }}:{{ required "Required value 'modelSpec.tag' must be defined !" $modelSpec.tag }}" | ||
|
|
@@ -175,7 +220,11 @@ spec: | |
| livenessProbe: | ||
| exec: | ||
| command: ["/bin/bash", "-c", "echo TBD"] | ||
| {{- if $modelSpec.raySpec.headNode.resources }} | ||
| resources: {{ toYaml $modelSpec.raySpec.headNode.resources | nindent 14 }} | ||
| {{- else }} | ||
| resources: {{- include "chart.resources" $modelSpec.raySpec.headNode | nindent 14 }} | ||
| {{- end }} | ||
| startupProbe: | ||
| exec: | ||
| command: ["/bin/bash", "-c", "python3 /scripts/wait_for_ray.py"] | ||
|
|
@@ -302,6 +351,51 @@ spec: | |
| securityContext: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| {{- if hasKey $modelSpec "initContainer" }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly to the head node, if the worker's {{- if and (hasKey $modelSpec "initContainer") $modelSpec.initContainer.name $modelSpec.initContainer.image }} |
||
| {{- $container := $modelSpec.initContainer }} | ||
| initContainers: | ||
| - name: {{ $container.name }} | ||
| image: {{ $container.image }} | ||
| {{- if $container.command }} | ||
| command: {{ toYaml $container.command | nindent 16 }} | ||
| {{- end }} | ||
| {{- if $container.args }} | ||
| args: {{ toYaml $container.args | nindent 16 }} | ||
| {{- end }} | ||
| {{- if $modelSpec.envFromSecret }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| envFrom: | ||
| - secretRef: | ||
| name: {{ $modelSpec.envFromSecret.name }} | ||
| {{- end }} | ||
| env: | ||
| - name: RELEASE_NAME | ||
| value: {{ .Release.Name }} | ||
| {{- if and .Values.cacheserverSpec.enabled .Values.cacheserverSpec.servicePort }} | ||
| - name: LMCACHE_SERVER_SERVICE_PORT | ||
| value: {{ .Values.cacheserverSpec.servicePort | quote }} | ||
| {{- end }} | ||
| {{- if $container.env }} | ||
| {{- toYaml $container.env | nindent 16 }} | ||
| {{- end }} | ||
| {{- if $container.resources }} | ||
| resources: {{ toYaml $container.resources | nindent 16 }} | ||
| {{- end }} | ||
| {{- $pvcMountEnabled := and (hasKey $container "mountPvcStorage") $container.mountPvcStorage (hasKey $modelSpec "pvcStorage") }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| {{- if or $pvcMountEnabled $container.extraVolumeMounts }} | ||
| volumeMounts: | ||
| {{- if $pvcMountEnabled }} | ||
| - name: {{ .Release.Name }}-storage | ||
| mountPath: /data | ||
| {{- end }} | ||
| {{- with $container.extraVolumeMounts }} | ||
| {{- toYaml . | nindent 16 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.servingEngineSpec.containerSecurityContext }} | ||
| securityContext: | ||
| {{- toYaml .Values.servingEngineSpec.containerSecurityContext | nindent 16 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| containers: | ||
| - name: vllm-ray-worker | ||
| image: "{{ required "Required value 'modelSpec.repository' must be defined !" $modelSpec.repository }}:{{ required "Required value 'modelSpec.tag' must be defined !" $modelSpec.tag }}" | ||
|
|
@@ -421,7 +515,11 @@ spec: | |
| livenessProbe: | ||
| exec: | ||
| command: ["/bin/bash", "-c", "echo TBD"] | ||
| {{- if $modelSpec.resources }} | ||
| resources: {{ toYaml $modelSpec.resources | nindent 16 }} | ||
| {{- else }} | ||
| resources: {{- include "chart.resources" $modelSpec | nindent 16 }} | ||
| {{- end }} | ||
| {{- if or (hasKey $modelSpec "pvcStorage") (and $modelSpec.vllmConfig (hasKey $modelSpec.vllmConfig "tensorParallelSize")) (hasKey $modelSpec "chatTemplate") (hasKey $modelSpec "extraVolumeMounts") $modelSpec.extraVolumeMounts }} | ||
| volumeMounts: | ||
| {{- end }} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
initContaineris defined but lacks anameorimage(e.g., if it is defined as an empty map{}), Helm will render invalid Kubernetes YAML becausenameandimageare required fields for containers. We should defensively check that bothnameandimageare specified before rendering theinitContainersblock.{{- if and (hasKey $modelSpec "raySpec") (hasKey $modelSpec.raySpec "headNode") (hasKey $modelSpec.raySpec.headNode "initContainer") $modelSpec.raySpec.headNode.initContainer.name $modelSpec.raySpec.headNode.initContainer.image }}