Files
chart/library/common/templates/lib/pod/_container.tpl
Stavros Kois 929e60d801 NAS-121003 / 23.10 / Adapt charts CI and improve/fix common (#1011)
* Adapt charts CI and improve/fix common

* add check on permissions contaienr

* add postgres template

* update comments

* Update create_app.sh

* add check

* update script

* auto gen item.yaml from Chart,yaml

* rename readme on dest

* duplicate readme from the same source

* correct comment

* reoder

* remove extra space

* keep both README and app-readme

* update regex, to also allow 2 letter names, which is also valid

* No need to check host network if there aren't any pod values

* use same pattern as the pod.name label (not prepending release-name

* update deps

* add chart dirs to ci

* Add a validation to check if there is any yaml errors after merging files

* update charts path on ci

* common/1.0.0/ -> common/

* update common-test dep path

* temp update create_app script

* make permissions container name configurable, incase we want to change order of execution

* update naming convention

* fix typo and a missed name change

* do not allow `--` in names
2023-03-16 17:36:19 +02:00

63 lines
3.0 KiB
Smarty

{{/* Returns Container */}}
{{/* Call this template:
{{ include "ix.v1.common.lib.pod.container" (dict "rootCtx" $ "objectData" $objectData) }}
rootCtx: The root context of the chart.
objectData: The object data to be used to render the Pod.
*/}}
{{- define "ix.v1.common.lib.pod.container" -}}
{{- $rootCtx := .rootCtx -}}
{{- $objectData := .objectData -}}
{{- $imageObj := fromJson (include "ix.v1.common.lib.container.imageSelector" (dict "rootCtx" $rootCtx "objectData" $objectData)) -}}
{{- $termination := fromJson (include "ix.v1.common.lib.container.termination" (dict "rootCtx" $rootCtx "objectData" $objectData)) }}
- name: {{ $objectData.name }}
image: {{ printf "%s:%s" $imageObj.repository $imageObj.tag }}
imagePullPolicy: {{ $imageObj.pullPolicy }}
tty: {{ $objectData.tty | default false }}
stdin: {{ $objectData.stdin | default false }}
{{- with (include "ix.v1.common.lib.container.command" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim) }}
command:
{{- . | nindent 4 }}
{{- end -}}
{{- with (include "ix.v1.common.lib.container.args" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim) }}
args:
{{- . | nindent 4 }}
{{- end -}}
{{- with $termination.messagePath }}
terminationMessagePath: {{ . }}
{{- end -}}
{{- with $termination.messagePolicy }}
terminationMessagePolicy: {{ . }}
{{- end -}}
{{- with (include "ix.v1.common.lib.container.lifecycle" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim) }}
lifecycle:
{{- . | nindent 4 }}
{{- end -}}
{{- with (include "ix.v1.common.lib.container.ports" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim) }}
ports:
{{- . | nindent 4 }}
{{- end -}}
{{- with (include "ix.v1.common.lib.container.volumeMount" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim) }}
volumeMounts:
{{- . | nindent 4 }}
{{- end -}}
{{- include "ix.v1.common.lib.container.probes" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 -}}
{{- with (include "ix.v1.common.lib.container.resources" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim) }}
resources:
{{- . | nindent 4 }}
{{- end }}
securityContext:
{{- include "ix.v1.common.lib.container.securityContext" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 4 }}
{{- /* Create a dict for storing env's so it can be checked for dupes */ -}}
{{- $_ := set $objectData "envDupe" dict -}}
{{- with (include "ix.v1.common.lib.container.envFrom" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim) }}
envFrom:
{{- . | nindent 4 }}
{{- end }}
env:
{{- include "ix.v1.common.lib.container.fixedEnv" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 4 -}}
{{- include "ix.v1.common.lib.container.env" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 4 -}}
{{- include "ix.v1.common.lib.container.envList" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 4 -}}
{{- $_ := unset $objectData "envDupe" -}}
{{- end -}}