Skip to content
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

[MLRun] Retain the DSN configuration within a secret #1051

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stable/mlrun/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: mlrun
version: 0.10.2
version: 0.10.3
appVersion: 1.7.1
description: Machine Learning automation and tracking
sources:
Expand Down
13 changes: 13 additions & 0 deletions stable/mlrun/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,16 @@ Resolve the nuclio api address (for mlrun-kit)
{{- printf "http://%s:8070" (include "mlrun.nuclio.dashboardName" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}

{{/*
Resolve the MLRun DB DSN
- If overrideDsn is set, use the external DB (overrideDsn).
- If overrideDsn is not set, use the internal DB (dsn).
*/}}
{{- define "mlrun.dsn" -}}
{{- if .Values.httpDB.overrideDsn -}}
{{- printf .Values.httpDB.overrideDsn -}}
{{- else -}}
{{- printf .Values.httpDB.dsn -}}
{{- end -}}
{{- end -}}
10 changes: 8 additions & 2 deletions stable/mlrun/templates/alerts-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,15 @@ spec:
value: {{ template "mlrun.defaultDockerRegistry.imagePullSecretName" . }}
{{- end }}
- name: MLRUN_HTTPDB__DSN
value: {{ .Values.httpDB.dsn }}
valueFrom:
secretKeyRef:
name: {{ include "mlrun.db.fullname" . }}
key: dsn
- name: MLRUN_HTTPDB__OLD_DSN
value: {{ .Values.httpDB.oldDsn }}
valueFrom:
secretKeyRef:
name: {{ include "mlrun.db.fullname" . }}
key: oldDsn
{{- if .Values.v3io.enabled }}
- name: V3IO_ACCESS_KEY
valueFrom:
Expand Down
10 changes: 8 additions & 2 deletions stable/mlrun/templates/api-chief-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,15 @@ spec:
value: {{ template "mlrun.defaultDockerRegistry.imagePullSecretName" . }}
{{- end }}
- name: MLRUN_HTTPDB__DSN
value: {{ .Values.httpDB.dsn }}
valueFrom:
secretKeyRef:
name: {{ include "mlrun.db.fullname" . }}
key: dsn
- name: MLRUN_HTTPDB__OLD_DSN
value: {{ .Values.httpDB.oldDsn }}
valueFrom:
secretKeyRef:
name: {{ include "mlrun.db.fullname" . }}
key: oldDsn
{{- if .Values.v3io.enabled }}
- name: V3IO_ACCESS_KEY
valueFrom:
Expand Down
10 changes: 8 additions & 2 deletions stable/mlrun/templates/api-worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ spec:
value: {{ template "mlrun.defaultDockerRegistry.imagePullSecretName" . }}
{{- end }}
- name: MLRUN_HTTPDB__DSN
value: {{ .Values.httpDB.dsn }}
valueFrom:
secretKeyRef:
name: {{ include "mlrun.db.fullname" . }}
key: dsn
- name: MLRUN_HTTPDB__OLD_DSN
value: {{ .Values.httpDB.oldDsn }}
valueFrom:
secretKeyRef:
name: {{ include "mlrun.db.fullname" . }}
key: oldDsn
{{- if .Values.v3io.enabled }}
- name: V3IO_ACCESS_KEY
valueFrom:
Expand Down
9 changes: 9 additions & 0 deletions stable/mlrun/templates/db-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "mlrun.db.fullname" . }}
labels:
{{- include "mlrun.db.labels" . | nindent 4 }}
data:
dsn: {{ include "mlrun.dsn" . | b64enc }}
oldDsn: {{ toYaml .Values.httpDB.oldDsn | b64enc }}
3 changes: 3 additions & 0 deletions stable/mlrun/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,9 @@ httpDB:
# sqlite database dsn from which to migrate if using mysql database
oldDsn: ""

# for external db
overrideDsn:

# Values to insert if mysql database is needed
# dsn: "mysql+pymysql://root@mlrun-db:3306/mlrun"
# oldDsn: "sqlite:////mlrun/db/mlrun.db?check_same_thread=false"
Expand Down
Loading