initial work for volumeMounts for extra contaienrs

This commit is contained in:
Stavros kois
2023-01-04 15:36:44 +02:00
parent c233f81cc8
commit 5c8da7d0b2
4 changed files with 27 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ can be dynamically configured via an env var.
{{- define "ix.v1.common.container.ports" -}}
{{- $defaultPortProtocol := .Values.global.defaults.portProtocol -}}
{{- $ports := list -}}
{{- range $svcName, $svc := .Values.service -}}
{{- if $svc.enabled -}}
{{- if not $svc.ports -}}
@@ -50,6 +51,7 @@ can be dynamically configured via an env var.
{{- end -}}
{{- end -}}
{{/* This is called by init/install/upgrade/additional containers only */}}
{{- define "ix.v1.common.container.extraContainerPorts" -}}
{{- $containerName := .containerName -}}
{{- $ports := .ports -}}

View File

@@ -1,18 +1,26 @@
{{/* Volume Mounts included by the container. */}}
{{- define "ix.v1.common.container.volumeMounts" -}}
{{- range $name, $item := .Values.persistence -}}
{{- if $item.enabled -}}
{{- if not $item.noMount -}}
{{- include "ix.v1.common.container.volumeMount" (dict "root" $ "item" $item "name" $name) | nindent 0 -}}
{{- $isMainContainer := .isMainContainer -}}
{{- $root := .root -}}
{{- $extraContainerVolMounts := .extraContainerVolMouts -}}
{{- if $isMainContainer -}}
{{- range $name, $item := $root.Values.persistence -}}
{{- if $item.enabled -}}
{{- if not $item.noMount -}}
{{- include "ix.v1.common.container.volumeMount" (dict "root" $root "item" $item "name" $name) | nindent 0 -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* TODO: write tests when statefulset is ready */}}
{{- if eq .Values.controller.type "statefulset" -}}
{{- range $index, $vct := .Values.volumeClaimTemplates -}}
{{- include "ix.v1.common.container.volumeMount" (dict "root" $ "item" $vct "name" (toString $index)) | nindent 0 -}}
{{/* TODO: write tests when statefulset is ready */}}
{{- if eq $root.Values.controller.type "statefulset" -}}
{{- range $index, $vct := $root.Values.volumeClaimTemplates -}}
{{- include "ix.v1.common.container.volumeMount" (dict "root" $root "item" $vct "name" (toString $index)) | nindent 0 -}}
{{- end -}}
{{- end -}}
{{- else if not $isMainContainer -}}
{{/* range themounts of extra contaienrs */}}
{{- end -}}
{{- end -}}

View File

@@ -90,6 +90,12 @@
ports:
{{- . | nindent 4 }}
{{- end -}}
{{- with (include "ix.v1.common.container.volumeMounts" (dict "root" $root
"extraContaienrVolMounts" $container.volumeMounts
"isMainContainer" false) | trim) }}
volumeMounts:
{{- . | nindent 4 }}
{{- end -}}
{{- with (include "ix.v1.common.container.resources" (dict "resources" $container.resources
"gpu" $container.scaleGPU
"isMainContainer" false

View File

@@ -54,7 +54,8 @@ So it can work on multiple places, like additional containers and not only the m
ports:
{{- . | nindent 4 }}
{{- end -}}
{{- with (include "ix.v1.common.container.volumeMounts" . | trim) }}
{{- with (include "ix.v1.common.container.volumeMounts" (dict "root" .
"isMainContainer" true) | trim) }}
volumeMounts:
{{- . | nindent 4 }}
{{- end -}}