apiVersion: v1 kind: ConfigMap metadata: name: {{ template "mlflow.fullname" . }}-env-configmap labels: app: {{ template "mlflow.name" . }} chart: {{ template "mlflow.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} data: {{- if .Values.backendStore.postgres.enabled }} PGHOST: {{ required "postgres host must be specified" .Values.backendStore.postgres.host }} PGPORT: {{ required "postgres port must be specified" .Values.backendStore.postgres.port | quote }} PGDATABASE: {{ required "postgres database must be specified" .Values.backendStore.postgres.database }} {{- end }} {{- if .Values.postgresql.enabled }} PGHOST: {{ template "mlflow.fullname" . }}-postgresql PGPORT: {{ default "5432" .Values.postgresql.primary.service.ports.postgresql | quote }} PGDATABASE: {{ .Values.postgresql.auth.database }} {{- end }} {{- if .Values.backendStore.mysql.enabled }} MYSQL_HOST: {{ required "mysql host must be specified" .Values.backendStore.mysql.host }} MYSQL_TCP_PORT: {{ required "mysql port must be specified" .Values.backendStore.mysql.port | quote }} MYSQL_DATABASE: {{ required "mysql database must be specified" .Values.backendStore.mysql.database }} {{- end }} {{- if .Values.backendStore.mssql.enabled }} MSSQL_HOST: {{ required "mssql host must be specified" .Values.backendStore.mssql.host }} MSSQL_TCP_PORT: {{ required "mssql port must be specified" .Values.backendStore.mssql.port | quote }} MSSQL_DATABASE: {{ required "mssql database must be specified" .Values.backendStore.mssql.database }} {{- end }} {{- if .Values.mysql.enabled }} MYSQL_HOST: {{ template "mlflow.fullname" . }}-mysql MYSQL_TCP_PORT: {{ default "3306" .Values.mysql.primary.service.ports.mysql | quote }} MYSQL_DATABASE: {{ .Values.mysql.auth.database }} {{- end }} MLFLOW_CONFIGURE_LOGGING: {{ .Values.log.enabled | quote }} {{- if .Values.log.enabled }} MLFLOW_LOGGING_LEVEL: {{ .Values.log.level | upper | quote }} {{- end }} {{- if not .Values.telemetry.enabled }} MLFLOW_DISABLE_TELEMETRY: "true" DO_NOT_TRACK: "true" {{- end }} --- {{- if and (or .Values.backendStore.postgres.enabled .Values.backendStore.mysql.enabled .Values.backendStore.mssql.enabled .Values.postgresql.enabled .Values.mysql.enabled) .Values.backendStore.databaseMigration }} {{- $dbConnectionDriver := "" }} {{- if and (or .Values.backendStore.postgres.enabled .Values.postgresql.enabled .Values.postgresql.enabled) .Values.backendStore.postgres.driver }} {{- $dbConnectionDriver = printf "+%s" .Values.backendStore.postgres.driver }} {{- else if and (or .Values.backendStore.mysql.enabled .Values.mysql.enabled) .Values.backendStore.mysql.driver }} {{- $dbConnectionDriver = printf "+%s" .Values.backendStore.mysql.driver }} {{- else if and .Values.backendStore.mssql.enabled .Values.backendStore.mssql.driver }} {{- $dbConnectionDriver = printf "+%s" .Values.backendStore.mssql.driver }} {{- end }} apiVersion: v1 kind: ConfigMap metadata: name: {{ template "mlflow.fullname" . }}-migrations labels: app: {{ template "mlflow.name" . }} chart: {{ template "mlflow.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} data: migrations.py: |- from mlflow.store.db import utils import os {{- if or .Values.backendStore.postgres.enabled .Values.postgresql.enabled }} engine = utils.create_sqlalchemy_engine_with_retry("postgresql{{ $dbConnectionDriver }}://") {{- else if or .Values.backendStore.mysql.enabled .Values.mysql.enabled }} username = os.getenv("MYSQL_USERNAME") password = os.getenv("MYSQL_PWD") host = os.getenv("MYSQL_HOST") port = os.getenv("MYSQL_TCP_PORT") database = os.getenv("MYSQL_DATABASE") engine = utils.create_sqlalchemy_engine_with_retry(f"mysql{{ $dbConnectionDriver }}://{username}:{password}@{host}:{port}/{database}") {{- else if .Values.backendStore.mssql.enabled }} username = os.getenv("MSSQL_USERNAME") password = os.getenv("MSSQL_PWD") host = os.getenv("MSSQL_HOST") port = os.getenv("MSSQL_TCP_PORT") database = os.getenv("MSSQL_DATABASE") engine = utils.create_sqlalchemy_engine_with_retry(f"mssql{{ $dbConnectionDriver }}://{username}:{password}@{host}:{port}/{database}") {{- end }} utils._initialize_tables(engine) {{- end }} {{- if and (or .Values.backendStore.postgres.enabled .Values.backendStore.mysql.enabled .Values.backendStore.mssql.enabled .Values.postgresql.enabled .Values.mysql.enabled) .Values.backendStore.databaseConnectionCheck }} --- apiVersion: v1 kind: ConfigMap metadata: name: {{ template "mlflow.fullname" . }}-dbchecker labels: app: {{ template "mlflow.name" . }} chart: {{ template "mlflow.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} data: {{ (.Files.Glob "files/dbchecker.sh").AsConfig | nindent 2 }} {{- end }}