common-helm-lib/templates/parts/_containers.tpl
2024-11-11 09:38:40 +01:00

54 lines
1.5 KiB
Smarty

{{- define "lib.parts.container" -}}
{{/*
create the environment varable list
*/}}
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 4 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.controller.command }}
command: {{ toYaml . | nindent 4}}
{{- end }}
{{- with .Values.controller.args }}
args: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controller.lifecycle }}
lifecycle:
{{- toYaml . | nindent 4 }}
{{- end }}
ports:
{{- range $name, $values := .Values.service -}}
{{- if $values.enabled -}}
{{- range $k, $v := $values.ports }}
- name: {{ $k }}
containerPort: {{ default $v.port $v.targetPort }}
{{- end -}}
{{- end -}}
{{- end }}
env:
{{- include "lib.parts.env" . | nindent 4 -}}
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if or .Values.volumeMounts .Values.volumeClaimTemplates }}
volumeMounts:
{{- end }}
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- range $v := .Values.volumeClaimTemplates }}
- name: {{ $v.name }}
mountPath: {{ $v.mountPath }}
{{- end }}
{{- end }}