common-helm-lib/templates/parts/_containers.tpl

54 lines
1.5 KiB
Smarty
Raw Permalink Normal View History

2024-10-22 12:29:12 +00:00
{{- 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 }}
2024-11-11 08:38:40 +00:00
{{- if or .Values.volumeMounts .Values.volumeClaimTemplates }}
2024-10-22 12:29:12 +00:00
volumeMounts:
2024-11-11 08:38:40 +00:00
{{- end }}
{{- with .Values.volumeMounts }}
2024-10-22 12:29:12 +00:00
{{- toYaml . | nindent 4 }}
{{- end }}
2024-11-11 08:38:40 +00:00
{{- range $v := .Values.volumeClaimTemplates }}
- name: {{ $v.name }}
mountPath: {{ $v.mountPath }}
{{- end }}
2024-10-22 12:29:12 +00:00
{{- end }}