Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
  • Loading branch information
fonhorst committed Dec 17, 2023
1 parent cc91016 commit ccbe7ac
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
18 changes: 18 additions & 0 deletions distributed/charts/autotm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,21 @@ Celery result backend url
{{- define "autotm.celery_result_backend" -}}
{{- printf "redis://%sredis:6379/1" (include "autotm.prefix" .) -}}
{{- end -}}

{{/*
Check if required persistent volume exists.
One should invoke it like '{{ include "autotm.find_pv" (list . "pv_mlflow_db") }}', where 'pv_mlflow_db' is a variable from values.yaml
See:
- https://stackoverflow.com/questions/70803242/helm-pass-single-string-to-a-template
- https://austindewey.com/2021/06/02/writing-function-based-templates-in-helm/
*/}}
{{- define "autotm.find_pv" -}}
{{- $root := index . 0 -}}
{{- $pv_var := index . 1 -}}
{{- $pv_name := (printf "%s%s" (include "autotm.prefix" $root) (get $root.Values $pv_var)) -}}
{{- $result := (lookup "v1" "PersistentVolume" "" $pv_name) -}}
{{- if empty $result -}}
{{- (printf "Persistent volume with name '%s' not found" $pv_name) | fail -}}
{{- end -}}
{{- $result.metadata.name -}}
{{- end -}}
16 changes: 8 additions & 8 deletions distributed/charts/autotm/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ metadata:
{{ $key }}: {{ $val | quote }}
{{- end }}
spec:
storageClassName: manual
volumeName: {{ .Values.pv_mlflow_db }}
storageClassName: {{ .Values.storage_class }}
volumeName: {{ include "autotm.find_pv" (list . "pv_mlflow_db") }}
accessModes:
- ReadWriteOnce
resources:
Expand All @@ -28,8 +28,8 @@ metadata:
{{ $key }}: {{ $val | quote }}
{{- end }}
spec:
storageClassName: manual
volumeName: {{ .Values.pv_mlflow_artifact_store }}
storageClassName: {{ .Values.storage_class }}
volumeName: {{ include "autotm.find_pv" (list . "pv_mlflow_artifact_store") }}
accessModes:
- ReadWriteMany
resources:
Expand All @@ -48,8 +48,8 @@ metadata:
{{ $key }}: {{ $val | quote }}
{{- end }}
spec:
storageClassName: manual
volumeName: {{ .Values.pv_mongo_db }}
storageClassName: {{ .Values.storage_class }}
volumeName: {{ include "autotm.find_pv" (list . "pv_mongo_db") }}
accessModes:
- ReadWriteOnce
resources:
Expand All @@ -68,8 +68,8 @@ metadata:
{{ $key }}: {{ $val | quote }}
{{- end }}
spec:
storageClassName: manual
volumeName: {{ .Values.pv_dataset_store }}
storageClassName: {{ .Values.storage_class }}
volumeName: {{ include "autotm.find_pv" (list . "pv_dataset_store") }}
accessModes:
- ReadOnly
resources:
Expand Down
1 change: 1 addition & 0 deletions distributed/charts/autotm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ flower_image: "node2.bdcl:5000/flower:latest"
worker_image: "node2.bdcl:5000/fitness-worker:latest"

### Volumes
storage_class: "manual"
pv_mlflow_db: "mlflow-db-pv"
pv_mlflow_artifact_store: "mlflow-artifact-store-pv"
pv_mongo_db: "mongo-tm-experiments-pv-part3"
Expand Down

0 comments on commit ccbe7ac

Please sign in to comment.