Skip to content

Commit 1b83c83

Browse files
committed
Refactor MySQL image tag handling in values.yaml and db-deployment.yaml to support automatic version selection based on MLRun appVersion. Add helper function for determining MySQL tag, allowing explicit overrides.
1 parent a071898 commit 1b83c83

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

stable/mlrun/templates/_helpers.tpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,23 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
183183
{{- printf "%s-init" (include "mlrun.db.fullname" .) | trunc 63 | trimSuffix "-" -}}
184184
{{- end -}}
185185

186+
{{/*
187+
Determine MySQL image tag based on MLRun appVersion.
188+
- If db.image.tag is explicitly set in values, use that (allows override)
189+
- Otherwise, use MySQL 8.0 for appVersion < 1.11.0, and MySQL 8.4 for appVersion >= 1.11.0
190+
*/}}
191+
{{- define "mlrun.db.mysqlTag" -}}
192+
{{- if .Values.db.image.tag -}}
193+
{{- .Values.db.image.tag -}}
194+
{{- else -}}
195+
{{- if semverCompare "<1.11.0" .Chart.AppVersion -}}
196+
{{- print "8.0" -}}
197+
{{- else -}}
198+
{{- print "8.4" -}}
199+
{{- end -}}
200+
{{- end -}}
201+
{{- end -}}
202+
186203

187204
{{/*
188205
This is to couple nuclio and mlrun charts, and comes to workaround the fact that the same

stable/mlrun/templates/db-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spec:
2828
terminationGracePeriodSeconds: 120
2929
initContainers:
3030
- name: init-mysql
31-
image: "{{ .Values.db.image.repository }}:{{ .Values.db.image.tag }}"
31+
image: "{{ .Values.db.image.repository }}:{{ include "mlrun.db.mysqlTag" . }}"
3232
imagePullPolicy: {{ .Values.db.image.pullPolicy }}
3333
resources:
3434
{{- toYaml .Values.db.resources | nindent 12 }}
@@ -47,7 +47,7 @@ spec:
4747
- name: {{ template "mlrun.name" . }}-{{ .Values.db.name }}
4848
securityContext:
4949
{{- toYaml .Values.db.securityContext | nindent 12 }}
50-
image: "{{ .Values.db.image.repository }}:{{ .Values.db.image.tag }}"
50+
image: "{{ .Values.db.image.repository }}:{{ include "mlrun.db.mysqlTag" . }}"
5151
imagePullPolicy: {{ .Values.db.image.pullPolicy }}
5252
command: ["/bin/bash", "/etc/config/mysql/v3io-mysql.sh"]
5353
ports:

stable/mlrun/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ db:
395395

396396
image:
397397
repository: mysql
398-
tag: "8.4"
398+
# MySQL tag is automatically determined based on MLRun appVersion:
399+
# - MySQL 8.0 for appVersion < 1.11.0
400+
# - MySQL 8.4 for appVersion >= 1.11.0
401+
# Set this value explicitly to override the automatic selection
402+
tag: ""
399403
pullPolicy: IfNotPresent
400404
pullSecrets: []
401405

0 commit comments

Comments
 (0)