Skip to content

Commit

Permalink
saving dsn in secret
Browse files Browse the repository at this point in the history
  • Loading branch information
moranbental committed Jan 7, 2025
1 parent 7892c41 commit 3edca15
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 7 deletions.
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

0 comments on commit 3edca15

Please sign in to comment.