mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
27 lines
1.2 KiB
Smarty
27 lines
1.2 KiB
Smarty
{{- /*
|
|
Returns the value for initContainers
|
|
*/ -}}
|
|
{{- define "bjw-s.common.lib.pod.field.initContainers" -}}
|
|
{{- $rootContext := .ctx.rootContext -}}
|
|
{{- $controllerObject := .ctx.controllerObject -}}
|
|
|
|
{{- /* Default to empty list */ -}}
|
|
{{- $containers := list -}}
|
|
|
|
{{- /* Fetch configured containers for this controller */ -}}
|
|
{{- range $key, $containerValues := $controllerObject.initContainers -}}
|
|
{{- /* Create object from the container values */ -}}
|
|
{{- $containerObject := (include "bjw-s.common.lib.container.valuesToObject" (dict "rootContext" $ "id" $key "values" $containerValues)) | fromYaml -}}
|
|
|
|
{{- /* Perform validations on the Container before rendering */ -}}
|
|
{{- include "bjw-s.common.lib.container.validate" (dict "rootContext" $ "object" $containerObject) -}}
|
|
|
|
{{- /* Generate the Container spec */ -}}
|
|
{{- $renderedContainer := include "bjw-s.common.lib.container.spec" (dict "rootContext" $rootContext "containerObject" $containerObject) | fromYaml -}}
|
|
{{- $containers = append $containers $renderedContainer -}}
|
|
{{- end -}}
|
|
|
|
{{- if not (empty $containers) -}}
|
|
{{- $containers | toYaml -}}
|
|
{{- end -}}
|
|
{{- end -}}
|