add mlflow chart v1.5.0

This commit is contained in:
admin
2024-11-04 01:34:21 +00:00
parent 142b8eaaaf
commit 3b49c41746
170 changed files with 22991 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}
** Please be patient while the chart is being deployed **
{{- if .Values.diagnosticMode.enabled }}
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}
Get the list of pods by executing:
kubectl get pods --namespace {{ include "common.names.namespace" . | quote }} -l app.kubernetes.io/instance={{ .Release.Name }}
Access the pod you want to debug by executing
kubectl exec --namespace {{ include "common.names.namespace" . | quote }} -ti <NAME OF THE POD> -- bash
{{- else }}
{{- if .Values.run.enabled }}
{{- if .Values.run.source.launchCommand }}
The following command will be executed:
{{- include "common.tplvalues.render" (dict "value" .Values.run.source.launchCommand "context" $) | nindent 2 }}
You can see the logs of each running node with:
kubectl logs [POD_NAME]
and the list of pods:
kubectl get pods --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ include "common.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"
{{- else }}
You didn't specify any entrypoint to your code.
To run it, you can either deploy again using the `source.launchCommand` option to specify your entrypoint, or execute it manually by jumping into the pods:
1. Get the running pods
kubectl get pods --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ include "common.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"
2. Get into a pod
kubectl exec -ti [POD_NAME] bash
3. Execute your script as you would normally do.
{{- end }}
{{- end }}
{{- if .Values.tracking.enabled }}
MLflow Tracking Server can be accessed through the following DNS name from within your cluster:
{{ include "mlflow.v0.tracking.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} (port {{ include "mlflow.v0.tracking.port" . }})
To access your MLflow site from outside the cluster follow the steps below:
{{- if .Values.tracking.ingress.enabled }}
1. Get the MLflow URL and associate MLflow hostname to your cluster external IP:
export CLUSTER_IP=$(minikube ip) # On Minikube. Use: `kubectl cluster-info` on others K8s clusters
echo "MLflow URL: http{{ if .Values.tracking.ingress.tls }}s{{ end }}://{{ .Values.tracking.ingress.hostname }}/"
echo "$CLUSTER_IP {{ .Values.tracking.ingress.hostname }}" | sudo tee -a /etc/hosts
{{- else }}
{{- $port := include "mlflow.v0.tracking.port" . | toString }}
1. Get the MLflow URL by running these commands:
{{- if contains "NodePort" .Values.tracking.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "mlflow.v0.tracking.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo "MLflow URL: {{ include "mlflow.v0.tracking.protocol" . }}://$NODE_IP:$NODE_PORT/"
{{- else if contains "LoadBalancer" .Values.tracking.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "mlflow.v0.tracking.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "mlflow.v0.tracking.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
echo "MLflow URL: {{ include "mlflow.v0.tracking.protocol" . }}://$SERVICE_IP{{- if ne $port "80" }}:{{ include "mlflow.v0.tracking.port" . }}{{ end }}/"
{{- else if contains "ClusterIP" .Values.tracking.service.type }}
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "mlflow.v0.tracking.fullname" . }} {{ include "mlflow.v0.tracking.port" . }}:{{ include "mlflow.v0.tracking.port" . }} &
echo "MLflow URL: {{ include "mlflow.v0.tracking.protocol" . }}://127.0.0.1{{- if ne $port "80" }}:{{ include "mlflow.v0.tracking.port" . }}{{ end }}//"
{{- end }}
{{- end }}
2. Open a browser and access MLflow using the obtained URL.
{{- if .Values.tracking.enabled }}
3. Login with the following credentials below to see your blog:
echo Username: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "mlflow.v0.tracking.fullname" . }} -o jsonpath="{ .data.{{ include "mlflow.v0.tracking.userKey" . }} }" | base64 -d)
echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "mlflow.v0.tracking.fullname" . }} -o jsonpath="{.data.{{ include "mlflow.v0.tracking.passwordKey" . }} }" | base64 -d)
{{- end }}
{{- end }}
{{- end }}
{{- include "common.warnings.rollingTag" .Values.image }}
{{- include "mlflow.v0.validateValues" . }}
{{- include "common.warnings.resources" (dict "sections" (list "run" "tracking" "volumePermissions") "context" $) }}
{{- include "common.warnings.modifiedImages" (dict "images" (list .Values.image .Values.gitImage .Values.volumePermissions.image .Values.waitContainer.image) "context" $) }}
+800
View File
@@ -0,0 +1,800 @@
{{/*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{/*
Return the proper image name
*/}}
{{- define "mlflow.v0.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper image name (for the init container volume-permissions image)
*/}}
{{- define "mlflow.v0.volumePermissions.image" -}}
{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}}
{{- end -}}
{{/*
Return the proper image name (for the init container wait-permissions image)
*/}}
{{- define "mlflow.v0.waitContainer.image" -}}
{{- include "common.images.image" ( dict "imageRoot" .Values.waitContainer.image "global" .Values.global ) -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "mlflow.v0.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image .Values.waitContainer.image .Values.volumePermissions.image) "context" $) -}}
{{- end -}}
{{/*
Fullname of the tracking service
*/}}
{{- define "mlflow.v0.tracking.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "tracking" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "mlflow.v0.tracking.serviceAccountName" -}}
{{- if .Values.tracking.serviceAccount.create -}}
{{ default (include "mlflow.v0.tracking.fullname" .) .Values.tracking.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.tracking.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Return the MLflow Tracking Secret Name
*/}}
{{- define "mlflow.v0.tracking.secretName" -}}
{{- if .Values.tracking.auth.existingSecret -}}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.auth.existingSecret "context" $) -}}
{{- else -}}
{{- include "mlflow.v0.tracking.fullname" . -}}
{{- end -}}
{{- end -}}
{{/*
Return the MLflow Tracking Secret key for the password
*/}}
{{- define "mlflow.v0.tracking.passwordKey" -}}
{{- coalesce .Values.tracking.auth.existingSecretPasswordKey "admin-password" -}}
{{- end -}}
{{/*
Return the MLflow Tracking Secret key for the user
*/}}
{{- define "mlflow.v0.tracking.userKey" -}}
{{- coalesce .Values.tracking.auth.existingSecretUserKey "admin-user" -}}
{{- end -}}
{{/*
Return the MLFlow Tracking Port
*/}}
{{- define "mlflow.v0.tracking.port" -}}
{{- int ( ternary .Values.tracking.service.ports.https .Values.tracking.service.ports.http .Values.tracking.tls.enabled ) -}}
{{- end -}}
{{/*
Return the MLFlow Tracking Port Name
*/}}
{{- define "mlflow.v0.tracking.portName" -}}
{{- ternary "https" "http" .Values.tracking.tls.enabled -}}
{{- end -}}
{{/*
Return the MLFlow Tracking Protocol
*/}}
{{- define "mlflow.v0.tracking.protocol" -}}
{{- ternary "https" "http" .Values.tracking.tls.enabled -}}
{{- end -}}
{{/*
Return the MLFlow Tracking URI
*/}}
{{- define "mlflow.v0.tracking.uri" -}}
{{ printf "%s://%s:%v" (include "mlflow.v0.tracking.protocol" .) (include "mlflow.v0.tracking.fullname" .) (include "mlflow.v0.tracking.port" .) }}
{{- end -}}
{{/*
Get the source configmap.
*/}}
{{- define "mlflow.v0.tracking.auth.overridesConfigMapName" -}}
{{- if .Values.tracking.auth.overridesConfigMap -}}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.auth.overridesConfigMap "context" $) -}}
{{- else }}
{{- printf "%s-auth-overrides" (include "mlflow.v0.tracking.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{/*
Init container definition for copying the certificates
*/}}
{{- define "mlflow.v0.tracking.copyCertsInitContainer" -}}
- name: copy-certs
image: {{ include "mlflow.v0.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.tracking.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.tracking.containerSecurityContext "context" $) | nindent 4 }}
{{- end }}
command:
- bash
- -ec
- |
#!/bin/bash
cp -L /tmp/certs/* /bitnami/mlflow/certs
chmod 600 {{ include "mlflow.v0.tracking.tlsCertKey" . }}
volumeMounts:
- name: tmp
mountPath: /tmp
- name: raw-certificates
mountPath: /tmp/certs
- name: mlflow-certificates
mountPath: /bitnami/mlflow/certs
{{- end }}
{{/*
Init container definition for waiting for the database to be ready
*/}}
{{- define "mlflow.v0.tracking.renderAuthConfInitContainer" -}}
- name: get-default-auth-conf
image: {{ include "mlflow.v0.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.tracking.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.tracking.containerSecurityContext "context" $) | nindent 4 }}
{{- end }}
command:
- bash
- -ec
- |
#!/bin/bash
cp /bitnami/mlflow-basic-auth/basic_auth.ini /bitnami/rendered-basic-auth/basic_auth.ini
volumeMounts:
- name: tmp
mountPath: /tmp
- name: rendered-basic-auth
mountPath: /bitnami/rendered-basic-auth
- name: render-auth-conf
image: {{ include "mlflow.v0.waitContainer.image" . }}
imagePullPolicy: {{ .Values.waitContainer.image.pullPolicy }}
{{- if .Values.tracking.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.tracking.containerSecurityContext "context" $) | nindent 4 }}
{{- end }}
command:
- bash
- -ec
- |
#!/bin/bash
# First render the overrides
render-template /bitnami/basic-auth-overrides/*.ini > /tmp/rendered-overrides.ini
# Loop through the ini overrides and apply it to the final basic_auth.ini
# read the file line by line
while IFS='=' read -r key value
do
# remove leading and trailing spaces from key and value
key="$(echo $key | tr -d " ")"
value="$(echo $value | tr -d " ")"
ini-file set -s mlflow -k "$key" -v "$value" /bitnami/rendered-basic-auth/basic_auth.ini
done < "/tmp/rendered-overrides.ini"
# Remove temporary files
rm /tmp/rendered-overrides.ini
env:
{{- if (include "mlflow.v0.database.enabled" .) }}
- name: MLFLOW_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.database.secretName" . }}
key: {{ include "mlflow.v0.database.passwordKey" . | quote }}
- name: MLFLOW_DATABASE_AUTH_URI
value: {{ include "mlflow.v0.database-auth.uri" . | quote }}
{{- end }}
- name: MLFLOW_TRACKING_USERNAME
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.tracking.secretName" . }}
key: {{ include "mlflow.v0.tracking.userKey" . | quote }}
- name: MLFLOW_TRACKING_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.tracking.secretName" . }}
key: {{ include "mlflow.v0.tracking.passwordKey" . | quote }}
{{- if .Values.tracking.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.extraEnvVars "context" $) | nindent 4 }}
{{- end }}
envFrom:
{{- if .Values.tracking.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.tracking.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.tracking.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.tracking.extraEnvVarsSecret "context" $) }}
{{- end }}
volumeMounts:
- name: tmp
mountPath: /tmp
- name: basic-auth-overrides
mountPath: /bitnami/basic-auth-overrides
- name: rendered-basic-auth
mountPath: /bitnami/rendered-basic-auth
{{- end -}}
{{/*
Init container definition for upgrading the database
*/}}
{{- define "mlflow.v0.tracking.upgradeDBInitContainer" -}}
- name: upgrade-db
image: {{ include "mlflow.v0.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.tracking.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.tracking.containerSecurityContext "context" $) | nindent 4 }}
{{- end }}
command:
- mlflow
args:
- db
- upgrade
- {{ include "mlflow.v0.database.uri" . }}
env:
- name: MLFLOW_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.database.secretName" . }}
key: {{ include "mlflow.v0.database.passwordKey" . | quote }}
volumeMounts:
- name: tmp
mountPath: /tmp
{{- end -}}
{{/*
Init container definition for upgrading the database
*/}}
{{- define "mlflow.v0.tracking.upgradeDBAuthInitContainer" -}}
- name: upgrade-db-auth
image: {{ include "mlflow.v0.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.tracking.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.tracking.containerSecurityContext "context" $) | nindent 4 }}
{{- end }}
command:
- python
args:
- -m
- mlflow.server.auth
- db
- upgrade
- --url
- {{ include "mlflow.v0.database-auth.uri" . }}
env:
- name: MLFLOW_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.database.secretName" . }}
key: {{ include "mlflow.v0.database.passwordKey" . | quote }}
volumeMounts:
- name: tmp
mountPath: /tmp
{{- end -}}
{{/*
Return true if a TLS credentials secret object should be created
*/}}
{{- define "mlflow.v0.tracking.createTlsSecret" -}}
{{- if and .Values.tracking.tls.autoGenerated (not .Values.tracking.tls.certificatesSecret) }}
{{- true -}}
{{- end -}}
{{- end -}}
{{/*
Return the path to the CA cert file.
*/}}
{{- define "mlflow.v0.tracking.tlsSecretName" -}}
{{- if .Values.tracking.tls.autoGenerated }}
{{- printf "%s-crt" (include "mlflow.v0.tracking.fullname" .) -}}
{{- else -}}
{{ required "A secret containing TLS certificates is required when TLS is enabled" .Values.tracking.tls.certificatesSecret }}
{{- end -}}
{{- end -}}
{{/*
Return the path to the cert file.
*/}}
{{- define "mlflow.v0.tracking.tlsCert" -}}
{{- if .Values.tracking.tls.autoGenerated }}
{{- printf "/bitnami/mlflow/certs/tls.crt" -}}
{{- else -}}
{{- required "Certificate filename is required when TLS in enabled" .Values.tracking.tls.certFilename | printf "/bitnami/mlflow/certs/%s" -}}
{{- end -}}
{{- end -}}
{{/*
Return the path to the cert key file.
*/}}
{{- define "mlflow.v0.tracking.tlsCertKey" -}}
{{- if .Values.tracking.tls.autoGenerated }}
{{- printf "/bitnami/mlflow/certs/tls.key" -}}
{{- else -}}
{{- required "Certificate Key filename is required when TLS in enabled" .Values.tracking.tls.certKeyFilename | printf "/bitnami/mlflow/certs/%s" -}}
{{- end -}}
{{- end -}}
{{/*
Return the path to the CA cert file.
*/}}
{{- define "mlflow.v0.tracking.tlsCACert" -}}
{{- if .Values.tracking.tls.autoGenerated }}
{{- printf "/bitnami/mlflow/certs/ca.crt" -}}
{{- else -}}
{{- if .Values.tracking.tls.certCAFilename -}}
{{- printf "/bitnami/mlflow/certs/%s" .Values.tracking.tls.certCAFilename -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Fullname of the run service
*/}}
{{- define "mlflow.v0.run.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "run" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create the name of the service account to use (run deployment)
*/}}
{{- define "mlflow.v0.run.serviceAccountName" -}}
{{- if .Values.run.serviceAccount.create -}}
{{ default (include "mlflow.v0.run.fullname" .) .Values.run.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.run.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Return true if the source configmap should be created
*/}}
{{- define "mlflow.v0.run.source.createConfigMap" -}}
{{- if and (eq .Values.run.source.type "configmap") .Values.run.source.configMap (not .Values.run.source.existingConfigMap) -}}
{{- true -}}
{{- end }}
{{- end -}}
{{/*
Get the source configmap.
*/}}
{{- define "mlflow.v0.run.source.configMapName" -}}
{{- if .Values.run.source.existingConfigMap -}}
{{- include "common.tplvalues.render" (dict "value" .Values.run.source.existingConfigMap "context" $) -}}
{{- else }}
{{- printf "%s-source" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{/*
Return PostgreSQL fullname
*/}}
{{- define "mlflow.v0.postgresql.fullname" -}}
{{- include "common.names.dependency.fullname" (dict "chartName" "postgresql" "chartValues" .Values.postgresql "context" $) -}}
{{- end -}}
{{/*
Return the PostgreSQL Hostname
*/}}
{{- define "mlflow.v0.database.enabled" -}}
{{- if or .Values.postgresql.enabled .Values.externalDatabase.host -}}
{{- true }}
{{- end -}}
{{- end -}}
{{/*
Return the Database Dialect(+Driver)
*/}}
{{- define "mlflow.v0.database.dialectDriver" -}}
{{- if .Values.postgresql.enabled -}}
{{- print "postgresql" -}}
{{- else -}}
{{- print .Values.externalDatabase.dialectDriver -}}
{{- end -}}
{{- end -}}
{{/*
Return the PostgreSQL Hostname
*/}}
{{- define "mlflow.v0.database.host" -}}
{{- if .Values.postgresql.enabled -}}
{{- if eq .Values.postgresql.architecture "replication" -}}
{{- printf "%s-%s" (include "mlflow.v0.postgresql.fullname" .) "primary" | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- print (include "mlflow.v0.postgresql.fullname" .) -}}
{{- end -}}
{{- else -}}
{{- print .Values.externalDatabase.host -}}
{{- end -}}
{{- end -}}
{{/*
Return the PostgreSQL Port
*/}}
{{- define "mlflow.v0.database.port" -}}
{{- if .Values.postgresql.enabled -}}
{{- printf "%d" (.Values.postgresql.primary.service.ports.postgresql | int) -}}
{{- else -}}
{{- printf "%d" (.Values.externalDatabase.port | int) -}}
{{- end -}}
{{- end -}}
{{/*
Return the PostgreSQL User
*/}}
{{- define "mlflow.v0.database.user" -}}
{{- if .Values.postgresql.enabled -}}
{{- print .Values.postgresql.auth.username -}}
{{- else -}}
{{- print .Values.externalDatabase.user -}}
{{- end -}}
{{- end -}}
{{/*
Return PostgreSQL database name
*/}}
{{- define "mlflow.v0.database.name" -}}
{{- if .Values.postgresql.enabled -}}
{{- print .Values.postgresql.auth.database -}}
{{- else -}}
{{- print .Values.externalDatabase.database -}}
{{- end -}}
{{- end -}}
{{/*
Return PostgreSQL auth database name
NOTE: This macro is run in both the parent chart and the PostgreSQL
subchart (as it is used in the init scripts), so we need to control the
scope
*/}}
{{- define "mlflow.v0.database-auth.name" -}}
{{- if .Values.postgresql -}}
{{/* Inside parent chart */}}
{{- if .Values.postgresql.enabled -}}
{{- printf "%s_auth" .Values.postgresql.auth.database -}}
{{- else -}}
{{- print .Values.externalDatabase.authDatabase -}}
{{- end -}}
{{- else -}}
{{/* Inside postgresql sub-chart, therefore postgresql.enabled=true */}}
{{- printf "%s_auth" .Values.auth.database -}}
{{- end -}}
{{- end -}}
{{/*
Return the PostgreSQL Secret Name
*/}}
{{- define "mlflow.v0.database.secretName" -}}
{{- if .Values.postgresql.enabled -}}
{{- if .Values.postgresql.auth.existingSecret -}}
{{- print .Values.postgresql.auth.existingSecret -}}
{{- else -}}
{{- print (include "mlflow.v0.postgresql.fullname" .) -}}
{{- end -}}
{{- else if .Values.externalDatabase.existingSecret -}}
{{- print .Values.externalDatabase.existingSecret -}}
{{- else -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "externaldb" -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve key of the PostgreSQL secret
*/}}
{{- define "mlflow.v0.database.passwordKey" -}}
{{- if .Values.postgresql.enabled -}}
{{- print "password" -}}
{{- else -}}
{{- print .Values.externalDatabase.existingSecretPasswordKey -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve the URI of the database
*/}}
{{- define "mlflow.v0.database.uri" -}}
{{- printf "%s://%s:$(MLFLOW_DATABASE_PASSWORD)@%s:%v/%s" (include "mlflow.v0.database.dialectDriver" .) (include "mlflow.v0.database.user" .) (include "mlflow.v0.database.host" .) (include "mlflow.v0.database.port" .) (include "mlflow.v0.database.name" .) -}}
{{- end -}}
{{/*
Retrieve the URI of the auth database
*/}}
{{- define "mlflow.v0.database-auth.uri" -}}
{{- printf "%s://%s:$(MLFLOW_DATABASE_PASSWORD)@%s:%v/%s" (include "mlflow.v0.database.dialectDriver" .) (include "mlflow.v0.database.user" .) (include "mlflow.v0.database.host" .) (include "mlflow.v0.database.port" .) (include "mlflow.v0.database-auth.name" .) -}}
{{- end -}}
{{/*
Return the volume-permissions init container
*/}}
{{- define "mlflow.v0.volumePermissionsInitContainer" -}}
- name: volume-permissions
image: {{ include "mlflow.v0.volumePermissions.image" }}
imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
command:
- /bin/bash
args:
- -ec
- |
#!/bin/bash
mkdir -p {{ .Values.persistence.mountPath }}
chown {{ .Values.volumePermissions.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }} {{ .Values.persistence.mountPath }}
find {{ .Values.persistence.mountPath }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs chown -R {{ .Values.volumePermissions.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }}
{{- if .Values.volumePermissions.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.volumePermissions.containerSecurityContext "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- else if ne .Values.volumePermissions.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.volumePermissions.resourcesPreset) | nindent 12 }}
{{- end }}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
- name: tmp
mountPath: /tmp
{{- end -}}
{{/*
Deal with external artifact storage
*/}}
{{/*
Return MinIO(TM) fullname
*/}}
{{- define "mlflow.v0.minio.fullname" -}}
{{- include "common.names.dependency.fullname" (dict "chartName" "minio" "chartValues" .Values.minio "context" $) -}}
{{- end -}}
{{/*
Return whether S3 is enabled
*/}}
{{- define "mlflow.v0.s3.enabled" -}}
{{- if or .Values.minio.enabled .Values.externalS3.host -}}
{{- true }}
{{- end -}}
{{- end -}}
{{/*
Return whether artifacts should be served from S3
*/}}
{{- define "mlflow.v0.s3.serveArtifacts" -}}
{{- if and (or .Values.minio.enabled .Values.externalS3.host) .Values.externalS3.serveArtifacts -}}
{{- true }}
{{- end -}}
{{- end -}}
{{/*
Return the S3 backend host
*/}}
{{- define "mlflow.v0.s3.host" -}}
{{- if .Values.minio.enabled -}}
{{- include "mlflow.v0.minio.fullname" . -}}
{{- else -}}
{{- print .Values.externalS3.host -}}
{{- end -}}
{{- end -}}
{{/*
Return the S3 port
*/}}
{{- define "mlflow.v0.s3.port" -}}
{{- ternary .Values.minio.service.ports.api .Values.externalS3.port .Values.minio.enabled -}}
{{- end -}}
{{/*
Return the S3 bucket
*/}}
{{- define "mlflow.v0.s3.bucket" -}}
{{- if .Values.minio.enabled -}}
{{- print .Values.minio.defaultBuckets -}}
{{- else -}}
{{- print .Values.externalS3.bucket -}}
{{- end -}}
{{- end -}}
{{/*
Return the S3 protocol
*/}}
{{- define "mlflow.v0.s3.protocol" -}}
{{- if .Values.minio.enabled -}}
{{- ternary "https" "http" .Values.minio.tls.enabled -}}
{{- else -}}
{{- print .Values.externalS3.protocol -}}
{{- end -}}
{{- end -}}
{{/*
Return the S3 credentials secret name
*/}}
{{- define "mlflow.v0.s3.secretName" -}}
{{- if .Values.minio.enabled -}}
{{- if .Values.minio.auth.existingSecret -}}
{{- print .Values.minio.auth.existingSecret -}}
{{- else -}}
{{- print (include "mlflow.v0.minio.fullname" .) -}}
{{- end -}}
{{- else if .Values.externalS3.existingSecret -}}
{{- print .Values.externalS3.existingSecret -}}
{{- else -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "externals3" -}}
{{- end -}}
{{- end -}}
{{/*
Return the S3 access key id inside the secret
*/}}
{{- define "mlflow.v0.s3.accessKeyIDKey" -}}
{{- if .Values.minio.enabled -}}
{{- print "root-user" -}}
{{- else -}}
{{- print .Values.externalS3.existingSecretAccessKeyIDKey -}}
{{- end -}}
{{- end -}}
{{/*
Return the S3 secret access key inside the secret
*/}}
{{- define "mlflow.v0.s3.secretAccessKeyKey" -}}
{{- if .Values.minio.enabled -}}
{{- print "root-password" -}}
{{- else -}}
{{- print .Values.externalS3.existingSecretKeySecretKey -}}
{{- end -}}
{{- end -}}
{{/*
Return whether GCS is enabled
*/}}
{{- define "mlflow.v0.gcs.enabled" -}}
{{- if and (not .Values.minio.enabled) (not .Values.externalS3.host) .Values.externalGCS.bucket -}}
{{- true }}
{{- end -}}
{{- end -}}
{{/*
Return the proper git image name
*/}}
{{- define "mlflow.v0.git.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.gitImage "global" .Values.global) }}
{{- end -}}
{{/*
Return the definition of the git clone init container
*/}}
{{- define "mlflow.v0.git.cloneInitContainer" -}}
- name: git-clone-repository
image: {{ include "mlflow.v0.git.image" . }}
imagePullPolicy: {{ .Values.gitImage.pullPolicy | quote }}
command:
- /bin/bash
args:
- -ec
- |
#!/bin/bash
rm -rf /app/*
[[ -f "/opt/bitnami/scripts/git/entrypoint.sh" ]] && source "/opt/bitnami/scripts/git/entrypoint.sh"
git clone {{ .Values.run.source.git.repository }} {{ if .Values.run.source.git.revision }}--branch {{ .Values.run.source.git.revision }}{{ end }} /app
{{- if .Values.run.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.run.containerSecurityContext "context" $) | nindent 4 }}
{{- end }}
volumeMounts:
- name: source
mountPath: /app
- name: tmp
mountPath: /tmp
# It creates at startup ssh in case it performs ssh-based git clone
- name: tmp
mountPath: /etc/ssh
{{- if .Values.run.source.git.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.run.source.git.extraVolumeMounts "context" .) | nindent 12 }}
{{- end }}
{{- end -}}
{{/*
Init container definition for waiting for the database to be ready
*/}}
{{- define "mlflow.v0.waitForServiceInitContainer" -}}
- name: {{ printf "wait-for-%s" .target }}
image: {{ include "mlflow.v0.waitContainer.image" .context }}
imagePullPolicy: {{ .context.Values.waitContainer.image.pullPolicy }}
{{- if .context.Values.waitContainer.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .context.Values.waitContainer.containerSecurityContext "context" .context) | nindent 4 }}
{{- end }}
command:
- bash
- -ec
- |
#!/bin/bash
retry_while() {
local -r cmd="${1:?cmd is missing}"
local -r retries="${2:-12}"
local -r sleep_time="${3:-5}"
local return_value=1
read -r -a command <<< "$cmd"
for ((i = 1 ; i <= retries ; i+=1 )); do
"${command[@]}" && return_value=0 && break
sleep "$sleep_time"
done
return $return_value
}
check_host() {
local -r host="${1:-?missing host}"
local -r port="${2:-?missing port}"
if wait-for-port --timeout=5 --host=${host} --state=inuse $port ; then
return 0
else
return 1
fi
}
echo "Checking connection to {{ .host }}:{{ .port }}"
if ! retry_while "check_host {{ .host }} {{ .port }}"; then
echo "Connection error"
exit 1
fi
echo "Connection success"
exit 0
volumeMounts:
- name: tmp
mountPath: /tmp
{{- end -}}
{{/*
Compile all warnings into a single message.
*/}}
{{- define "mlflow.v0.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "mlflow.v0.validateValues.job" .) -}}
{{- $messages := append $messages (include "mlflow.v0.validateValues.auth" .) -}}
{{- $messages := append $messages (include "mlflow.v0.validateValues.deploy" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}
{{- if $message -}}
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
{{- end -}}
{{- end -}}
{{/* Check that a command has been defined when using a job */}}
{{- define "mlflow.v0.validateValues.job" -}}
{{- if and .Values.run.useJob (not .Values.run.source.launchCommand) (not .Values.run.args) }}
mlflow: no-job-command
You defined MLflow to be launched as a job but specified no command. Use the run.source.launchCommand value
to specify a command.
{{- end -}}
{{- end -}}
{{/* Check that the database is deployed when enabling authorization */}}
{{- define "mlflow.v0.validateValues.auth" -}}
{{- if and .Values.tracking.auth.enabled (not (include "mlflow.v0.database.enabled" .)) -}}
mlflow: auth-requires-db
You enabled basic authentication but did not configure a database. Please set postgresql.enabled=true or configure the externalDatabase section.
{{- end -}}
{{- end -}}
{{/* Check that one of the deployments is enabled */}}
{{- define "mlflow.v0.validateValues.deploy" -}}
{{- if and (not .Values.tracking.enabled) (not .Values.run.enabled) -}}
mlflow: no-deploy
You did not deploy either a MLflow job or the tracking server. Please set one of the two: tracking.enabled=true or run.enabled=true
{{- end -}}
{{- end -}}
+9
View File
@@ -0,0 +1,9 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- range .Values.extraDeploy }}
---
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
{{- end }}
+237
View File
@@ -0,0 +1,237 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.run.enabled }}
apiVersion: {{ ternary "batch/v1" "apps/v1" .Values.run.useJob }}
kind: {{ ternary "Job" "Deployment" .Values.run.useJob }}
metadata:
name: {{ include "mlflow.v0.run.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.run.labels .Values.commonLabels ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: run
{{- if or .Values.run.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.run.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.run.podLabels .Values.commonLabels ) "context" . ) }}
{{- if not .Values.run.useJob }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: run
{{- end }}
{{- if .Values.run.useJob }}
backoffLimit: {{ .Values.run.backoffLimit }}
{{- else }}
{{- if .Values.run.updateStrategy }}
strategy: {{- toYaml .Values.run.updateStrategy | nindent 4 }}
{{- end }}
{{- end }}
template:
metadata:
annotations:
checksum/source: {{ include (print $.Template.BasePath "/run/source-configmap.yaml") . | sha256sum }}
{{- if or .Values.run.podAnnotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.run.podAnnotations .Values.commonAnnotations ) "context" . ) }}
{{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: run
spec:
{{- include "mlflow.v0.imagePullSecrets" . | nindent 6 }}
serviceAccountName: {{ template "mlflow.v0.run.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.run.automountServiceAccountToken }}
{{- if .Values.run.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.run.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.run.useJob }}
restartPolicy: {{ .Values.run.restartPolicy }}
{{- end }}
{{- if .Values.run.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.run.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.run.podAffinityPreset "component" "run" "customLabels" $podLabels "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.run.podAntiAffinityPreset "component" "run" "customLabels" $podLabels "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.run.nodeAffinityPreset.type "key" .Values.run.nodeAffinityPreset.key "values" .Values.run.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.run.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.run.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.run.runtimeClassName }}
runtimeClassName: {{ .Values.run.runtimeClassName | quote }}
{{- end }}
{{- if .Values.run.podSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.run.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.run.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.run.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.run.priorityClassName }}
priorityClassName: {{ .Values.run.priorityClassName | quote }}
{{- end }}
{{- if .Values.run.schedulerName }}
schedulerName: {{ .Values.run.schedulerName | quote }}
{{- end }}
{{- if .Values.run.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.run.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.run.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.run.terminationGracePeriodSeconds }}
{{- end }}
initContainers:
{{- if .Values.run.enableDefaultInitContainers }}
{{- if eq .Values.run.source.type "git" }}
# Clone git repository
{{- include "mlflow.v0.git.cloneInitContainer" $ | nindent 8 }}
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.run.persistence.enabled }}
# Adjust volume permissions
{{- include "mlflow.v0.volumePermissionsInitContainer" (dict "component" "run" "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.tracking.auth.enabled }}
# Wait for tracking service
{{- include "mlflow.v0.waitForServiceInitContainer" (dict "target" "tracking" "host" (include "mlflow.v0.tracking.fullname" .) "port" (include "mlflow.v0.tracking.port" .) "context" $) | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.run.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.run.initContainers "context" $) | nindent 8}}
{{- end }}
containers:
- name: mlflow
image: {{ include "mlflow.v0.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
{{- if .Values.run.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.run.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.run.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.run.command "context" $) | nindent 12 }}
{{- else }}
command:
- bash
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.run.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.run.args "context" $) | nindent 12 }}
{{- else }}
args:
- -ec
- |
#!/bin/bash
{{- if .Values.run.source.launchCommand }}
{{- include "common.tplvalues.render" (dict "value" .Values.run.source.launchCommand "context" $) | nindent 14 }}
{{- end }}
{{- if not .Values.run.useJob }}
sleep infinity
{{- end }}
{{- end }}
env:
- name: BITNAMI_DEBUG
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
{{- if .Values.tracking.enabled }}
- name: MLFLOW_TRACKING_URI
value: {{ include "mlflow.v0.tracking.uri" . | quote }}
{{- if and .Values.tracking.tls.enabled .Values.tracking.tls.autoGenerated }}
- name: MLFLOW_TRACKING_INSECURE_TLS
value: "true"
{{- end }}
{{- if .Values.tracking.auth.enabled }}
- name: MLFLOW_TRACKING_USERNAME
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.tracking.secretName" . }}
key: {{ include "mlflow.v0.tracking.userKey" . | quote }}
- name: MLFLOW_TRACKING_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.tracking.secretName" . }}
key: {{ include "mlflow.v0.tracking.passwordKey" . | quote }}
{{- end }}
{{- end }}
{{- if .Values.run.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.run.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.run.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.run.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.run.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.run.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.run.resources }}
resources: {{- toYaml .Values.run.resources | nindent 12 }}
{{- else if ne .Values.run.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.run.resourcesPreset) | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.run.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.run.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.run.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.run.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.run.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.run.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.run.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.run.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: source
mountPath: /app
- name: tmp
mountPath: /tmp
- name: mlruns
mountPath: /app/mlruns
- name: mlartifacts
mountPath: /app/mlartifacts
{{- if .Values.run.persistence.enabled }}
- name: data
mountPath: {{ .Values.run.persistence.mountPath }}
{{- if .Values.run.persistence.subPath }}
subPath: {{ .Values.run.persistence.subPath }}
{{- end }}
{{- end }}
{{- if .Values.run.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.run.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.run.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.run.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: tmp
emptyDir: {}
- name: mlruns
emptyDir: {}
- name: mlartifacts
emptyDir: {}
- name: source
{{- if or (.Values.run.source.existingConfigMap) (include "mlflow.v0.run.source.createConfigMap" .) }}
configMap:
name: {{ include "mlflow.v0.run.source.configMapName" . }}
{{- else }}
emptyDir: {}
{{- end }}
- name: data
{{- if .Values.run.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.run.persistence.existingClaim | default (include "mlflow.v0.run.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.run.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.run.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}
@@ -0,0 +1,61 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.run.enabled .Values.run.networkPolicy.enabled }}
kind: NetworkPolicy
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
metadata:
name: {{ template "mlflow.v0.run.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: run
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.tracking.podLabels .Values.commonLabels ) "context" . ) }}
podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: run
policyTypes:
- Ingress
- Egress
{{- if .Values.run.networkPolicy.allowExternalEgress }}
egress:
- {}
{{- else }}
egress:
# Allow dns resolution
- ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
# Allow connection to these sources for downloading models
- port: 80
- port: 443
- port: 22
{{- if .Values.tracking.enabled }}
# Allow outbound connections to other pods
- ports:
- port: {{ .Values.tracking.containerPorts.http }}
- port: {{ include "mlflow.v0.tracking.port" . }}
to:
- podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 14 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- end }}
{{- if .Values.run.networkPolicy.extraEgress }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.networkPolicy.extraEgress "context" $) | nindent 4 }}
{{- end }}
{{- end }}
ingress:
{{- if .Values.run.networkPolicy.extraIngress }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.networkPolicy.extraIngress "context" $) | nindent 4 }}
{{- end }}
{{- end }}
+39
View File
@@ -0,0 +1,39 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.run.enabled .Values.run.persistence.enabled (not .Values.run.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "mlflow.v0.run.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.run.persistence.labels .Values.commonLabels ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: run
{{- if or .Values.run.persistence.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.run.persistence.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
accessModes:
{{- if not (empty .Values.run.persistence.accessModes) }}
{{- range .Values.run.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
{{- else }}
- {{ .Values.run.persistence.accessMode | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.run.persistence.size | quote }}
{{- if .Values.run.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.run.persistence.selector "context" $) | nindent 4 }}
{{- end -}}
{{- include "common.storage.class" (dict "persistence" .Values.run.persistence "global" .Values.global) | nindent 2 }}
{{- if .Values.run.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.run.persistence.dataSource "context" $) | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,20 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.run.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "mlflow.v0.run.serviceAccountName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: run
{{- if or .Values.run.serviceAccount.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" ( list .Values.run.serviceAccount.annotations .Values.commonAnnotations ) "context" .) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.run.serviceAccount.automountServiceAccountToken }}
{{- end }}
@@ -0,0 +1,18 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if (include "mlflow.v0.run.source.createConfigMap" .) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "mlflow.v0.run.source.configMapName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
data:
{{- include "common.tplvalues.render" (dict "value" .Values.run.source.configMap "context" $) | nindent 2 }}
{{- end }}
@@ -0,0 +1,22 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tracking.enabled .Values.tracking.auth.enabled (not .Values.tracking.auth.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "mlflow.v0.tracking.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
data:
# We need to ad the username as it is required by the ServiceMonitor object
admin-user: {{ include "common.secrets.passwords.manage" (dict "secret" (include "mlflow.v0.tracking.fullname" .) "key" "admin-user" "providedValues" (list "tracking.auth.username") "context" $) }}
admin-password: {{ include "common.secrets.passwords.manage" (dict "secret" (include "mlflow.v0.tracking.fullname" .) "key" "admin-password" "providedValues" (list "tracking.auth.password") "context" $) }}
{{- end }}
@@ -0,0 +1,25 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tracking.enabled .Values.tracking.auth.enabled (not .Values.tracking.auth.overridesConfigMap) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-auth-overrides" (include "mlflow.v0.tracking.fullname" .) | trunc 63 | trimSuffix "-" }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
# Use render-template to substitute with environment variables
basic_auth_overrides.ini: |
database_uri = {{ print "{{ MLFLOW_DATABASE_AUTH_URI }}" }}
admin_username = {{ print "{{ MLFLOW_TRACKING_USERNAME }}" }}
admin_password = {{ print "{{ MLFLOW_TRACKING_PASSWORD }}" }}
{{- range $key, $value := .Values.tracking.auth.extraOverrides }}
{{ $key }} = {{ include "common.tplvalues.render" (dict "value" $value "context" $) }}
{{- end }}
{{- end }}
@@ -0,0 +1,341 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.tracking.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "mlflow.v0.tracking.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.tracking.autoscaling.hpa.enabled }}
replicas: {{ .Values.tracking.replicaCount }}
{{- end }}
{{- if .Values.tracking.updateStrategy }}
strategy: {{- toYaml .Values.tracking.updateStrategy | nindent 4 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" (dict "values" (list .Values.tracking.podLabels .Values.commonLabels) "context" .) | fromYaml }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
template:
metadata:
{{- if or .Values.tracking.podAnnotations .Values.tracking.auth.enabled }}
annotations:
{{- if .Values.tracking.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.podAnnotations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.tracking.auth.enabled }}
checksum/auth: {{ include (print $.Template.BasePath "/tracking/configmap-overrides.yaml") . | sha256sum }}
{{- end }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
spec:
serviceAccountName: {{ include "mlflow.v0.tracking.serviceAccountName" . }}
{{- include "mlflow.v0.imagePullSecrets" . | nindent 6 }}
automountServiceAccountToken: {{ .Values.tracking.automountServiceAccountToken }}
{{- if .Values.tracking.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.tracking.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.tracking.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.tracking.podAffinityPreset "component" "mlflow" "customLabels" $podLabels "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.tracking.podAntiAffinityPreset "component" "mlflow" "customLabels" $podLabels "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.tracking.nodeAffinityPreset.type "key" .Values.tracking.nodeAffinityPreset.key "values" .Values.tracking.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.tracking.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.tracking.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.tracking.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.tracking.priorityClassName }}
priorityClassName: {{ .Values.tracking.priorityClassName | quote }}
{{- end }}
{{- if .Values.tracking.schedulerName }}
schedulerName: {{ .Values.tracking.schedulerName | quote }}
{{- end }}
{{- if .Values.tracking.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.tracking.podSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.tracking.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.tracking.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.tracking.terminationGracePeriodSeconds }}
{{- end }}
initContainers:
{{- if .Values.tracking.enableDefaultInitContainers }}
{{- if .Values.tracking.tls.enabled }}
{{- include "mlflow.v0.tracking.copyCertsInitContainer" . | nindent 8 }}
{{- end }}
{{- if and (include "mlflow.v0.database.enabled" .) }}
# Init container for PostgreSQL
{{- include "mlflow.v0.waitForServiceInitContainer" (dict "target" "database" "host" (include "mlflow.v0.database.host" .) "port" (include "mlflow.v0.database.port" .) "context" $) | nindent 8 }}
{{- if .Values.tracking.runUpgradeDB }}
# Perform upgrade of the Database
{{- include "mlflow.v0.tracking.upgradeDBInitContainer" . | nindent 8 }}
{{- end }}
{{- if .Values.tracking.auth.enabled }}
# Render basic auth configuration
{{- include "mlflow.v0.tracking.renderAuthConfInitContainer" . | nindent 8 }}
# Perform upgrade of the Auth Database
{{- include "mlflow.v0.tracking.upgradeDBAuthInitContainer" . | nindent 8 }}
{{- end }}
{{- if (include "mlflow.v0.s3.enabled" .) }}
# Wait for S3 backend to be ready
{{- include "mlflow.v0.waitForServiceInitContainer" (dict "target" "s3" "host" (include "mlflow.v0.s3.host" .) "port" (include "mlflow.v0.s3.port" .) "context" $) | nindent 8 }}
{{- end }}
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.tracking.persistence.enabled }}
# Adjust volume permissions
{{- include "mlflow.v0.volumePermissionsInitContainer" . | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.tracking.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: mlflow
image: {{ include "mlflow.v0.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.tracking.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.tracking.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.tracking.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.command "context" $) | nindent 12 }}
{{- else }}
command:
- mlflow
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.tracking.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.args "context" $) | nindent 12 }}
{{- else }}
args:
- server
{{- if .Values.tracking.tls.enabled }}
- --gunicorn-opts
- --certfile {{ include "mlflow.v0.tracking.tlsCert" . }} --keyfile {{ include "mlflow.v0.tracking.tlsCertKey" . }} {{- if (include "mlflow.v0.tracking.tlsCACert" .)}} --ca-certs {{ include "mlflow.v0.tracking.tlsCACert" . }}{{- end }}
{{- end }}
{{- if (include "mlflow.v0.database.enabled" .) }}
- --backend-store-uri={{ include "mlflow.v0.database.uri" . }}
{{- else }}
- --backend-store-uri={{ .Values.tracking.persistence.mountPath }}/mlruns
{{- end }}
{{- if (include "mlflow.v0.s3.enabled" .) }}
- --artifacts-destination=s3://{{ include "mlflow.v0.s3.bucket" . }}
{{- else if (include "mlflow.v0.gcs.enabled" .) }}
- --artifacts-destination=gs://{{ .Values.externalGCS.bucket }}
{{- else }}
- --artifacts-destination={{ .Values.tracking.persistence.mountPath }}/mlartifacts
{{- end }}
{{- if and (not (include "mlflow.v0.s3.serveArtifacts" .)) (include "mlflow.v0.s3.enabled" .) }}
- --default-artifact-root=s3://{{ include "mlflow.v0.s3.bucket" . }}
- --no-serve-artifacts
{{- else if and (not .Values.externalGCS.serveArtifacts) (include "mlflow.v0.gcs.enabled" .) }}
- --default-artifact-root=gs://{{ .Values.externalGCS.bucket }}
- --no-serve-artifacts
{{ else }}
- --serve-artifacts
{{- end }}
- --host=0.0.0.0
- --port={{ .Values.tracking.containerPorts.http }}
{{- if .Values.tracking.metrics.enabled }}
- --expose-prometheus={{ .Values.tracking.persistence.mountPath }}/metrics
{{- end }}
{{- if .Values.tracking.auth.enabled }}
- --app-name=basic-auth
{{- end }}
{{- if .Values.tracking.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
env:
- name: BITNAMI_DEBUG
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
{{- if (include "mlflow.v0.database.enabled" .) }}
- name: MLFLOW_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.database.secretName" . }}
key: {{ include "mlflow.v0.database.passwordKey" . | quote }}
{{- end }}
{{- if (include "mlflow.v0.s3.enabled" .) }}
{{- if .Values.externalS3.useCredentialsInSecret }}
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.s3.secretName" . }}
key: {{ include "mlflow.v0.s3.accessKeyIDKey" . | quote }}
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "mlflow.v0.s3.secretName" . }}
key: {{ include "mlflow.v0.s3.secretAccessKeyKey" . | quote }}
{{- end }}
{{- end }}
{{- if (include "mlflow.v0.s3.enabled" .) }}
- name: MLFLOW_S3_ENDPOINT_URL
value: {{ printf "%s://%s:%v" (include "mlflow.v0.s3.protocol" .) (include "mlflow.v0.s3.host" .) (include "mlflow.v0.s3.port" .) | quote }}
{{- end }}
{{- if (include "mlflow.v0.gcs.enabled" .) }}
{{- if .Values.externalGCS.useCredentialsInSecret }}
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /bitnami/gcs/key.json
{{- end }}
{{- if .Values.externalGCS.googleCloudProject }}
- name: GOOGLE_CLOUD_PROJECT
value: {{ .Values.externalGCS.googleCloudProject }}
{{- end }}
{{- end }}
{{- if .Values.tracking.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.tracking.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.tracking.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.tracking.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.tracking.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.tracking.resources }}
resources: {{- toYaml .Values.tracking.resources | nindent 12 }}
{{- else if ne .Values.tracking.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.tracking.resourcesPreset) | nindent 12 }}
{{- end }}
ports:
- name: {{ include "mlflow.v0.tracking.portName" . }}
containerPort: {{ .Values.tracking.containerPorts.http }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.tracking.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.tracking.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.tracking.livenessProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- pgrep
- -f
- mlflow.server
{{- end }}
{{- if .Values.tracking.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.tracking.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.tracking.readinessProbe "enabled") "context" $) | nindent 12 }}
{{- if .Values.tracking.auth.enabled }}
tcpSocket:
port: {{ include "mlflow.v0.tracking.portName" . }}
{{- else }}
httpGet:
path: /
port: {{ include "mlflow.v0.tracking.portName" . }}
{{- end }}
{{- end }}
{{- if .Values.tracking.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.tracking.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.tracking.startupProbe "enabled") "context" $) | nindent 12 }}
{{- if .Values.tracking.auth.enabled }}
tcpSocket:
port: {{ include "mlflow.v0.tracking.portName" . }}
{{- else }}
httpGet:
path: /
port: {{ include "mlflow.v0.tracking.portName" . }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.tracking.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: tmp
mountPath: /tmp
- name: mlruns
mountPath: /app/mlruns
- name: mlartifacts
mountPath: /app/mlartifacts
{{- if .Values.tracking.tls.enabled }}
- name: mlflow-certificates
mountPath: /bitnami/mlflow/certs
readOnly: true
{{- end }}
{{- if .Values.tracking.auth.enabled }}
- name: rendered-basic-auth
mountPath: /bitnami/mlflow-basic-auth/basic_auth.ini
subPath: basic_auth.ini
{{- end }}
- name: data
mountPath: {{ .Values.tracking.persistence.mountPath }}
{{- if .Values.tracking.persistence.subPath }}
subPath: {{ .Values.tracking.persistence.subPath }}
{{- end }}
{{- if and (include "mlflow.v0.gcs.enabled" .) .Values.externalGCS.useCredentialsInSecret }}
- name: gcs-key
mountPath: /bitnami/gcs/key.json
subPath: key.json
{{- end }}
{{- if .Values.tracking.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.tracking.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.tracking.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: tmp
emptyDir: {}
- name: mlruns
emptyDir: {}
- name: mlartifacts
emptyDir: {}
{{- if .Values.tracking.tls.enabled }}
- name: raw-certificates
secret:
secretName: {{ include "mlflow.v0.tracking.tlsSecretName" . }}
- name: mlflow-certificates
emptyDir: {}
{{- end }}
{{- if .Values.tracking.auth.enabled }}
- name: basic-auth-overrides
configMap:
name: {{ include "mlflow.v0.tracking.auth.overridesConfigMapName" . }}
- name: rendered-basic-auth
emptyDir: {}
{{- end }}
- name: data
{{- if .Values.tracking.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.tracking.persistence.existingClaim | default (include "mlflow.v0.tracking.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.tracking.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if and (include "mlflow.v0.gcs.enabled" .) .Values.externalGCS.useCredentialsInSecret }}
- name: gcs-key
secret:
secretName: {{ .Values.externalGCS.existingSecret }}
items:
- key: {{ .Values.externalGCS.existingSecretKey }}
path: key.json
{{- end }}
{{- end }}
@@ -0,0 +1,21 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tracking.enabled (not .Values.postgresql.enabled) (not .Values.externalDatabase.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "mlflow.v0.database.secretName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
data:
db-password: {{ .Values.externalDatabase.password | b64enc | quote }}
{{- end }}
@@ -0,0 +1,27 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and
.Values.tracking.enabled
.Values.externalS3.useCredentialsInSecret
(not .Values.minio.enabled)
(not .Values.externalS3.existingSecret)
}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "mlflow.v0.s3.secretName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
type: Opaque
data:
{{ .Values.externalS3.existingSecretAccessKeyIDKey }}: {{ .Values.externalS3.accessKeyID | b64enc | quote }}
{{ .Values.externalS3.existingSecretKeySecretKey }}: {{ .Values.externalS3.accessKeySecret | b64enc | quote }}
{{- end }}
+50
View File
@@ -0,0 +1,50 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tracking.enabled .Values.tracking.autoscaling.hpa.enabled }}
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "mlflow.v0.tracking.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "mlflow.v0.tracking.fullname" . }}
minReplicas: {{ .Values.tracking.autoscaling.hpa.minReplicas }}
maxReplicas: {{ .Values.tracking.autoscaling.hpa.maxReplicas }}
metrics:
{{- if .Values.tracking.autoscaling.hpa.targetMemory }}
- type: Resource
resource:
name: memory
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.tracking.autoscaling.hpa.targetMemory }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.tracking.autoscaling.hpa.targetMemory }}
{{- end }}
{{- end }}
{{- if .Values.tracking.autoscaling.hpa.targetCPU }}
- type: Resource
resource:
name: cpu
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.tracking.autoscaling.hpa.targetCPU }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.tracking.autoscaling.hpa.targetCPU }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,48 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.tracking.ingress.enabled }}
{{- if .Values.tracking.ingress.secrets }}
{{- range .Values.tracking.ingress.secrets }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .name }}
namespace: {{ include "common.names.namespace" $ | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $.Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if $.Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
tls.crt: {{ .certificate | b64enc }}
tls.key: {{ .key | b64enc }}
---
{{- end }}
{{- end }}
{{- if and .Values.tracking.ingress.tls .Values.tracking.ingress.selfSigned }}
{{- $secretName := printf "%s-tls" .Values.tracking.ingress.hostname }}
{{- $ca := genCA "mlflow-ca" 365 }}
{{- $cert := genSignedCert .Values.tracking.ingress.hostname nil (list .Values.tracking.ingress.hostname) 365 $ca }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
namespace: {{ include "common.names.namespace" $ | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
{{- end }}
{{- end }}
@@ -0,0 +1,61 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tracking.enabled .Values.tracking.ingress.enabled }}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ template "mlflow.v0.tracking.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if or .Values.tracking.ingress.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" ( list .Values.tracking.ingress.annotations .Values.commonAnnotations ) "context" .) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.tracking.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
ingressClassName: {{ .Values.tracking.ingress.ingressClassName | quote }}
{{- end }}
rules:
{{- if .Values.tracking.ingress.hostname }}
- host: {{ .Values.tracking.ingress.hostname }}
http:
paths:
{{- if .Values.tracking.ingress.extraPaths }}
{{- toYaml .Values.tracking.ingress.extraPaths | nindent 10 }}
{{- end }}
- path: {{ .Values.tracking.ingress.path }}
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.tracking.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "mlflow.v0.tracking.fullname" .) "servicePort" (include "mlflow.v0.tracking.protocol" $) "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.tracking.ingress.extraHosts }}
- host: {{ .name | quote }}
http:
paths:
- path: {{ default "/" .path }}
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "mlflow.v0.tracking.fullname" $) "servicePort" (include "mlflow.v0.tracking.protocol" $) "context" $) | nindent 14 }}
{{- end }}
{{- if .Values.tracking.ingress.extraRules }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.ingress.extraRules "context" $) | nindent 4 }}
{{- end }}
{{- if or (and .Values.tracking.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.tracking.ingress.annotations )) .Values.tracking.ingress.selfSigned)) .Values.tracking.ingress.extraTls }}
tls:
{{- if and .Values.tracking.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.tracking.ingress.annotations )) .Values.tracking.ingress.selfSigned) }}
- hosts:
- {{ .Values.tracking.ingress.hostname | quote }}
secretName: {{ printf "%s-tls" .Values.tracking.ingress.hostname }}
{{- end }}
{{- if .Values.tracking.ingress.extraTls }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.ingress.extraTls "context" $) | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,103 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tracking.enabled .Values.tracking.networkPolicy.enabled }}
kind: NetworkPolicy
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
metadata:
name: {{ template "mlflow.v0.tracking.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.tracking.podLabels .Values.commonLabels ) "context" . ) }}
podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
policyTypes:
- Ingress
- Egress
{{- if .Values.tracking.networkPolicy.allowExternalEgress }}
egress:
- {}
{{- else }}
egress:
# Allow dns resolution
- ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
# Allow connection to these sources for downloading models
- port: 80
- port: 443
- port: 22
# Allow outbound connections to other pods
- ports:
- port: {{ .Values.tracking.containerPorts.http }}
- port: {{ include "mlflow.v0.tracking.port" . }}
to:
- podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 14 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
# Allow outbound connections to the database
- ports:
- port: {{ include "mlflow.v0.database.port" . }}
{{- if .Values.postgresql.enabled }}
to:
- podSelector:
matchLabels:
app.kubernetes.io/name: postgresql
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
# Allow outbound connections to the S3 backend
- ports:
- port: {{ include "mlflow.v0.s3.port" . }}
{{- if .Values.minio.enabled }}
- port: {{ .Values.minio.containerPorts.api }}
to:
- podSelector:
matchLabels:
app.kubernetes.io/name: minio
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- if .Values.tracking.networkPolicy.extraEgress }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.networkPolicy.extraEgress "context" $) | nindent 4 }}
{{- end }}
{{- end }}
ingress:
- ports:
- port: {{ .Values.tracking.containerPorts.http }}
- port: {{ include "mlflow.v0.tracking.port" . }}
from:
{{- if not .Values.tracking.networkPolicy.allowExternal }}
- podSelector:
matchLabels:
{{ template "common.names.fullname" . }}-client: "true"
{{- end }}
{{- if .Values.tracking.networkPolicy.ingressNSMatchLabels }}
- namespaceSelector:
matchLabels:
{{- range $key, $value := .Values.tracking.networkPolicy.ingressNSMatchLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- if .Values.tracking.networkPolicy.ingressNSPodMatchLabels }}
podSelector:
matchLabels:
{{- range $key, $value := .Values.tracking.networkPolicy.ingressNSPodMatchLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.tracking.networkPolicy.extraIngress }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.networkPolicy.extraIngress "context" $) | nindent 4 }}
{{- end }}
{{- end }}
+30
View File
@@ -0,0 +1,30 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tracking.enabled .Values.tracking.pdb.create }}
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ include "mlflow.v0.tracking.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.tracking.pdb.minAvailable }}
minAvailable: {{ .Values.tracking.pdb.minAvailable }}
{{- end }}
{{- if or .Values.tracking.pdb.maxUnavailable ( not .Values.tracking.pdb.minAvailable ) }}
maxUnavailable: {{ .Values.tracking.pdb.maxUnavailable | default 1 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" (dict "values" (list .Values.tracking.podLabels .Values.commonLabels) "context" .) | fromYaml }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- end }}
+39
View File
@@ -0,0 +1,39 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tracking.enabled .Values.tracking.persistence.enabled (not .Values.tracking.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "mlflow.v0.tracking.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.tracking.persistence.labels .Values.commonLabels ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if or .Values.tracking.persistence.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.tracking.persistence.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
accessModes:
{{- if not (empty .Values.tracking.persistence.accessModes) }}
{{- range .Values.tracking.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
{{- else }}
- {{ .Values.tracking.persistence.accessMode | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.tracking.persistence.size | quote }}
{{- if .Values.tracking.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.persistence.selector "context" $) | nindent 4 }}
{{- end -}}
{{- include "common.storage.class" (dict "persistence" .Values.tracking.persistence "global" .Values.global) | nindent 2 }}
{{- if .Values.tracking.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.persistence.dataSource "context" $) | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,20 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.tracking.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "mlflow.v0.tracking.serviceAccountName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if or .Values.tracking.serviceAccount.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" ( list .Values.tracking.serviceAccount.annotations .Values.commonAnnotations ) "context" .) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.tracking.serviceAccount.automountServiceAccountToken }}
{{- end }}
@@ -0,0 +1,59 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.tracking.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "mlflow.v0.tracking.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.tracking.service.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.tracking.service.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.tracking.service.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" ( list .Values.tracking.service.annotations .Values.commonAnnotations ) "context" .) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.tracking.service.type }}
{{- if and .Values.tracking.service.clusterIP (eq .Values.tracking.service.type "ClusterIP") }}
clusterIP: {{ .Values.tracking.service.clusterIP }}
{{- end }}
{{- if .Values.tracking.service.sessionAffinity }}
sessionAffinity: {{ .Values.tracking.service.sessionAffinity }}
{{- end }}
{{- if .Values.tracking.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.tracking.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if or (eq .Values.tracking.service.type "LoadBalancer") (eq .Values.tracking.service.type "NodePort") }}
externalTrafficPolicy: {{ .Values.tracking.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if and (eq .Values.tracking.service.type "LoadBalancer") (not (empty .Values.tracking.service.loadBalancerSourceRanges)) }}
loadBalancerSourceRanges: {{ .Values.tracking.service.loadBalancerSourceRanges }}
{{- end }}
{{- if and (eq .Values.tracking.service.type "LoadBalancer") (not (empty .Values.tracking.service.loadBalancerIP)) }}
loadBalancerIP: {{ .Values.tracking.service.loadBalancerIP }}
{{- end }}
ports:
- name: {{ include "mlflow.v0.tracking.portName" . }}
port: {{ get .Values.tracking.service.ports (include "mlflow.v0.tracking.protocol" .) }}
protocol: TCP
{{- if and (or (eq .Values.tracking.service.type "NodePort") (eq .Values.tracking.service.type "LoadBalancer")) (not (empty (get .Values.tracking.service.nodePorts (include "mlflow.v0.tracking.protocol" .)))) }}
nodePort: {{ get .Values.tracking.service.nodePorts (include "mlflow.v0.tracking.protocol" .) }}
{{- else if eq .Values.tracking.service.type "ClusterIP" }}
nodePort: null
{{- end }}
targetPort: {{ include "mlflow.v0.tracking.portName" . }}
{{- if .Values.tracking.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" (dict "values" (list .Values.tracking.podLabels .Values.commonLabels) "context" .) | fromYaml }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- end }}
@@ -0,0 +1,59 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tracking.metrics.enabled .Values.tracking.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "mlflow.v0.tracking.fullname" . }}
namespace: {{ default (include "common.names.namespace" .) .Values.tracking.metrics.serviceMonitor.namespace | quote }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.tracking.metrics.serviceMonitor.labels .Values.commonLabels ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if or .Values.tracking.metrics.serviceMonitor.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.tracking.metrics.serviceMonitor.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.tracking.metrics.serviceMonitor.jobLabel | quote }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.tracking.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.tracking.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
endpoints:
- port: {{ include "mlflow.v0.tracking.portName" . }}
{{- if .Values.tracking.auth.enabled }}
basicAuth:
password:
key: {{ include "mlflow.v0.tracking.passwordKey" . }}
name: {{ include "mlflow.v0.tracking.secretName" . }}
username:
key: {{ include "mlflow.v0.tracking.userKey" . }}
name: {{ include "mlflow.v0.tracking.secretName" . }}
{{- end }}
path: "/metrics"
{{- if .Values.tracking.metrics.serviceMonitor.interval }}
interval: {{ .Values.tracking.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.tracking.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.tracking.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.tracking.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.tracking.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.tracking.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.tracking.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.tracking.metrics.serviceMonitor.relabelings }}
relabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.tracking.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ include "common.names.namespace" . | quote }}
{{- end }}
@@ -0,0 +1,30 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if (include "mlflow.v0.tracking.createTlsSecret" . ) }}
{{- $secretName := printf "%s-crt" (include "mlflow.v0.tracking.fullname" .) }}
{{- $ca := genCA "mlflow-ca" 365 }}
{{- $fullname := include "mlflow.v0.tracking.fullname" . }}
{{- $releaseNamespace := include "common.names.namespace" . }}
{{- $clusterDomain := .Values.clusterDomain }}
{{- $altNames := list (printf "*.%s.%s.svc.%s" $fullname $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $fullname $releaseNamespace $clusterDomain) "127.0.0.1" $fullname }}
{{- $cert := genSignedCert $fullname nil $altNames 365 $ca }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
{{- end }}
+47
View File
@@ -0,0 +1,47 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1/VerticalPodAutoscaler") .Values.tracking.autoscaling.vpa.enabled }}
apiVersion: {{ include "common.capabilities.vpa.apiVersion" . }}
kind: VerticalPodAutoscaler
metadata:
name: {{ include "mlflow.v0.tracking.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.image "chart" .Chart ) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mlflow
app.kubernetes.io/component: tracking
{{- if or .Values.tracking.autoscaling.vpa.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.tracking.autoscaling.vpa.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
resourcePolicy:
containerPolicies:
- containerName: mlflow
{{- with .Values.tracking.autoscaling.vpa.controlledResources }}
controlledResources:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tracking.autoscaling.vpa.maxAllowed }}
maxAllowed:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tracking.autoscaling.vpa.minAllowed }}
minAllowed:
{{- toYaml . | nindent 8 }}
{{- end }}
targetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "mlflow.v0.tracking.fullname" . }}
{{- if .Values.tracking.autoscaling.vpa.updatePolicy }}
updatePolicy:
{{- with .Values.tracking.autoscaling.vpa.updatePolicy.updateMode }}
updateMode: {{ . }}
{{- end }}
{{- end }}
{{- end }}