_containerSpawner.tpl 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. {{/* Containers */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.lib.pod.containerSpawner" (dict "rootCtx" $ "objectData" $objectData) }}
  4. rootCtx: The root context of the chart.
  5. objectData: The object data to be used to render the Pod.
  6. */}}
  7. {{- define "ix.v1.common.lib.pod.containerSpawner" -}}
  8. {{- $rootCtx := .rootCtx -}}
  9. {{- $objectData := .objectData -}}
  10. {{- include "ix.v1.common.lib.container.primaryValidation" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
  11. {{- range $containerName, $containerValues := $objectData.podSpec.containers -}}
  12. {{- if $containerValues.enabled -}}
  13. {{- $container := (mustDeepCopy $containerValues) -}}
  14. {{- $name := include "ix.v1.common.lib.chart.names.fullname" $rootCtx -}}
  15. {{- if not $container.primary -}}
  16. {{- $name = printf "%s-%s" $name $containerName -}}
  17. {{- end -}}
  18. {{- $_ := set $container "name" $name -}}
  19. {{- $_ := set $container "shortName" $containerName -}}
  20. {{- $_ := set $container "podShortName" $objectData.shortName -}}
  21. {{- $_ := set $container "podPrimary" $objectData.primary -}}
  22. {{- $_ := set $container "podType" $objectData.type -}}
  23. {{/* Created from the pod.securityContext, used by fixedEnv */}}
  24. {{- $_ := set $container "calculatedFSGroup" $objectData.podSpec.calculatedFSGroup -}}
  25. {{- include "ix.v1.common.lib.pod.container" (dict "rootCtx" $rootCtx "objectData" $container) | trim | nindent 0 -}}
  26. {{- end -}}
  27. {{- end -}}
  28. {{- end -}}