Skip to content

Commit 4a540ad

Browse files
committed
feat: Added bitnami style image registry override
Signed-off-by: Sylvain Filiatrault <19677334+slik13@users.noreply.github.com>
1 parent 9361821 commit 4a540ad

21 files changed

+100
-46
lines changed

charts/llm-d-modelservice/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type: application
1313
# This is the chart version. This version number should be incremented each time you make changes
1414
# to the chart and its templates, including the app version.
1515
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16-
version: "v0.4.9"
16+
version: "v0.4.10"
1717
# This is the version number of the application being deployed. This version number should be
1818
# incremented each time you make changes to the application. Versions are not expected to
1919
# follow Semantic Versioning. They should reflect the version the application is using.

charts/llm-d-modelservice/templates/_helpers.tpl

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,38 @@ affinity:
9191
{{- end }}
9292
{{- end }}
9393
{{- end }}
94+
95+
{{/* Rewrite an image reference to use a global registry override */}}
96+
{{- define "llm-d-modelservice.resolveImage" -}}
97+
{{- $image := required "image is required" .image -}}
98+
{{- $registryOverride := trimSuffix "/" (default "" .Values.global.imageRegistry) -}}
99+
{{- if not $registryOverride -}}
100+
{{- $image -}}
101+
{{- else -}}
102+
{{- $parts := splitList "/" $image -}}
103+
{{- $nameParts := $parts -}}
104+
{{- $first := index $parts 0 -}}
105+
{{- if and (gt (len $parts) 1) (or (contains "." $first) (contains ":" $first) (eq $first "localhost")) -}}
106+
{{- $nameParts = slice $parts 1 -}}
107+
{{- end -}}
108+
{{- printf "%s/%s" $registryOverride (join "/" $nameParts) -}}
109+
{{- end -}}
110+
{{- end }}
111+
112+
{{/* Render a list of container-like objects while applying image resolution */}}
113+
{{- define "llm-d-modelservice.renderContainerList" -}}
114+
{{- $renderedContainers := list -}}
115+
{{- range $container := (.containers | default list) -}}
116+
{{- $rendered := deepCopy $container -}}
117+
{{- if hasKey $rendered "image" -}}
118+
{{- $_ := set $rendered "image" (include "llm-d-modelservice.resolveImage" (dict "image" (index $rendered "image") "Values" $.Values) | trim) -}}
119+
{{- end -}}
120+
{{- $renderedContainers = append $renderedContainers $rendered -}}
121+
{{- end -}}
122+
{{- toYaml $renderedContainers -}}
123+
{{- end }}
124+
125+
94126
{{/* Create the init container for the routing proxy/sidecar for decode pods */}}
95127
{{- define "llm-d-modelservice.routingProxy" -}}
96128
{{- if or (not (hasKey .proxy "enabled")) (ne .proxy.enabled false) -}}
@@ -123,7 +155,7 @@ affinity:
123155
{{- if hasKey .proxy "certPath" }}
124156
- --cert-path={{ .proxy.certPath }}
125157
{{- end }}
126-
image: {{ required "routing.proxy.image must be specified" .proxy.image }}
158+
image: {{ include "llm-d-modelservice.resolveImage" (dict "image" (required "routing.proxy.image must be specified" .proxy.image) "Values" .Values) | trim }}
127159
imagePullPolicy: {{ default "Always" .proxy.imagePullPolicy }}
128160
env:
129161
{{- if and .Values.tracing .Values.tracing.enabled }}
@@ -465,7 +497,7 @@ context is a dict with helm root context plus:
465497
*/}}
466498
{{- define "llm-d-modelservice.container" -}}
467499
- name: {{ default "vllm" .container.name }}
468-
image: {{ required "image of container is required" .container.image }}
500+
image: {{ include "llm-d-modelservice.resolveImage" (dict "image" (required "image of container is required" .container.image) "Values" .Values) | trim }}
469501
{{- with .container.extraConfig }}
470502
{{ include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 2 }}
471503
{{- end }}

charts/llm-d-modelservice/templates/decode-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ spec:
4141
initContainers:
4242
{{- (include "llm-d-modelservice.routingProxy" (dict "proxy" .Values.routing.proxy "servicePort" .Values.routing.servicePort "Values" .Values)) | nindent 8 }}
4343
{{- if .Values.decode.initContainers }}
44-
{{- toYaml .Values.decode.initContainers | nindent 8 }}
44+
{{- include "llm-d-modelservice.renderContainerList" (dict "containers" .Values.decode.initContainers "Values" .Values) | nindent 8 }}
4545
{{- end }}
4646
{{- end }}
4747
{{- if hasKey .Values.decode "enableServiceLinks" }}

charts/llm-d-modelservice/templates/decode-lws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ spec:
5959
initContainers:
6060
{{- (include "llm-d-modelservice.routingProxy" (dict "proxy" .Values.routing.proxy "servicePort" .Values.routing.servicePort "Values" .Values)) | nindent 8 }}
6161
{{- if .Values.decode.initContainers }}
62-
{{- toYaml .Values.decode.initContainers | nindent 8 }}
62+
{{- include "llm-d-modelservice.renderContainerList" (dict "containers" .Values.decode.initContainers "Values" .Values) | nindent 8 }}
6363
{{- end }}
6464
{{- end }}
6565
{{- if hasKey .Values.decode "enableServiceLinks" }}

charts/llm-d-modelservice/templates/decode-requester-replicaset.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
initContainers:
2727
{{- (include "llm-d-modelservice.routingProxy" (dict "proxy" .Values.routing.proxy "servicePort" .Values.routing.servicePort "Values" .Values)) | nindent 12 }}
2828
{{- if .Values.decode.initContainers }}
29-
{{- toYaml .Values.decode.initContainers | nindent 12 }}
29+
{{- include "llm-d-modelservice.renderContainerList" (dict "containers" .Values.decode.initContainers "Values" .Values) | nindent 12 }}{{- toYaml .Values.decode.initContainers | nindent 12 }}
3030
{{- end }}
3131
{{- end }}
3232
{{- with .Values.decode.containers }}
@@ -38,7 +38,7 @@ spec:
3838
spec:
3939
containers:
4040
- name: inference-server
41-
image: {{ .Values.requester.image }}
41+
image: {{ include "llm-d-modelservice.resolveImage" (dict "image" .Values.requester.image "Values" .Values) | trim }}
4242
imagePullPolicy: Always
4343
command:
4444
- /app/requester

charts/llm-d-modelservice/templates/prefill-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
spec:
3636
{{- if .Values.prefill.initContainers }}
3737
initContainers:
38-
{{- toYaml .Values.prefill.initContainers | nindent 8 }}
38+
{{- include "llm-d-modelservice.renderContainerList" (dict "containers" .Values.prefill.initContainers "Values" .Values) | nindent 8 }}
3939
{{- end }}
4040
{{- if hasKey .Values.prefill "enableServiceLinks" }}
4141
enableServiceLinks: {{ .Values.prefill.enableServiceLinks }}

charts/llm-d-modelservice/templates/prefill-lws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
{{- end }}
5858
{{- if .Values.prefill.initContainers }}
5959
initContainers:
60-
{{- toYaml .Values.prefill.initContainers | nindent 8 }}
60+
{{- include "llm-d-modelservice.renderContainerList" (dict "containers" .Values.prefill.initContainers "Values" .Values) | nindent 8 }}
6161
{{- end }}
6262
{{- if hasKey .Values.prefill "enableServiceLinks" }}
6363
enableServiceLinks: {{ .Values.prefill.enableServiceLinks }}

charts/llm-d-modelservice/values.schema.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,10 +1921,18 @@
19211921
"title": "fullnameOverride"
19221922
},
19231923
"global": {
1924-
"description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.",
1924+
"additionalProperties": false,
1925+
"description": "Global values shared with subcharts",
1926+
"properties": {
1927+
"imageRegistry": {
1928+
"default": "",
1929+
"description": "Override the registry for built-in chart workload images while preserving repository path and tag or digest Example: \"registry.example.com\" or \"registry.example.com/team-cache\"",
1930+
"required": [],
1931+
"title": "imageRegistry"
1932+
}
1933+
},
19251934
"required": [],
1926-
"title": "global",
1927-
"type": "object"
1935+
"title": "global"
19281936
},
19291937
"modelArtifacts": {
19301938
"additionalProperties": false,

charts/llm-d-modelservice/values.schema.tmpl.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,18 @@
607607
"title": "fullnameOverride"
608608
},
609609
"global": {
610-
"description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.",
610+
"additionalProperties": false,
611+
"description": "Global values shared with subcharts",
612+
"properties": {
613+
"imageRegistry": {
614+
"default": "",
615+
"description": "Override the registry for built-in chart workload images while preserving repository path and tag or digest Example: \"registry.example.com\" or \"registry.example.com/team-cache\"",
616+
"required": [],
617+
"title": "imageRegistry"
618+
}
619+
},
611620
"required": [],
612-
"title": "global",
613-
"type": "object"
621+
"title": "global"
614622
},
615623
"modelArtifacts": {
616624
"additionalProperties": false,

charts/llm-d-modelservice/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
# -- Common configuration values
1010
common: {}
1111

12+
# -- Global values shared with subcharts
13+
global:
14+
# -- Override the registry for built-in chart workload images while preserving repository path and tag or digest
15+
# Example: "registry.example.com" or "registry.example.com/team-cache"
16+
imageRegistry: ""
17+
1218
# -- Usually used when using llm-d-modelservice as a subchart
1319
enabled: true
1420

0 commit comments

Comments
 (0)