Piped-Kubernetes/charts/apps/piped/templates/backend/lib/_pod.tpl

106 lines
3.5 KiB
Smarty
Raw Normal View History

2023-02-15 06:55:36 +05:30
{{- /*
The pod definition included in the controller.
*/ -}}
{{- define "backend.controller.pod" -}}
{{- with .Values.backend.imagePullSecrets }}
2023-02-15 06:55:36 +05:30
imagePullSecrets:
{{- toYaml . | nindent 2 }}
{{- end }}
serviceAccountName: {{ include "backend.names.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
{{- with .Values.backend.podSecurityContext }}
2023-02-15 06:55:36 +05:30
securityContext:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.backend.priorityClassName }}
2023-02-15 06:55:36 +05:30
priorityClassName: {{ . }}
{{- end }}
{{- with .Values.backend.runtimeClassName }}
2023-02-15 06:55:36 +05:30
runtimeClassName: {{ . }}
{{- end }}
{{- with .Values.backend.schedulerName }}
2023-02-15 06:55:36 +05:30
schedulerName: {{ . }}
{{- end }}
{{- with .Values.backend.hostNetwork }}
2023-02-15 06:55:36 +05:30
hostNetwork: {{ . }}
{{- end }}
{{- with .Values.backend.hostname }}
2023-02-15 06:55:36 +05:30
hostname: {{ . }}
{{- end }}
{{- if .Values.backend.dnsPolicy }}
dnsPolicy: {{ .Values.backend.dnsPolicy }}
{{- else if .Values.backend.hostNetwork }}
2023-02-15 06:55:36 +05:30
dnsPolicy: ClusterFirstWithHostNet
{{- else }}
dnsPolicy: ClusterFirst
{{- end }}
{{- with .Values.backend.dnsConfig }}
2023-02-15 06:55:36 +05:30
dnsConfig:
{{- toYaml . | nindent 2 }}
{{- end }}
enableServiceLinks: {{ .Values.backend.enableServiceLinks }}
2023-02-15 06:55:36 +05:30
{{- with .Values.termination.gracePeriodSeconds }}
terminationGracePeriodSeconds: {{ . }}
{{- end }}
{{- if .Values.backend.initContainers }}
2023-02-15 06:55:36 +05:30
initContainers:
{{- $initContainers := list }}
{{- range $index, $key := (keys .Values.backend.initContainers | uniq | sortAlpha) }}
2023-02-15 06:55:36 +05:30
{{- $container := get $.Values.initContainers $key }}
{{- if not $container.name -}}
{{- $_ := set $container "name" $key }}
{{- end }}
{{- if $container.env -}}
{{- $_ := set $ "ObjectValues" (dict "env" $container.env) -}}
{{- $newEnv := fromYaml (include "common.controller.env_vars" $) -}}
{{- $_ := unset $.ObjectValues "env" -}}
{{- $_ := set $container "env" $newEnv.env }}
{{- end }}
{{- $initContainers = append $initContainers $container }}
{{- end }}
{{- tpl (toYaml $initContainers) $ | nindent 2 }}
{{- end }}
containers:
{{- include "backend.controller.mainContainer" . | nindent 2 }}
{{- with .Values.additionalContainers }}
{{- $additionalContainers := list }}
{{- range $name, $container := . }}
{{- if not $container.name -}}
{{- $_ := set $container "name" $name }}
{{- end }}
{{- if $container.env -}}
{{- $_ := set $ "ObjectValues" (dict "env" $container.env) -}}
{{- $newEnv := fromYaml (include "backend.controller.env_vars" $) -}}
{{- $_ := set $container "env" $newEnv.env }}
{{- $_ := unset $.ObjectValues "env" -}}
{{- end }}
{{- $additionalContainers = append $additionalContainers $container }}
{{- end }}
{{- tpl (toYaml $additionalContainers) $ | nindent 2 }}
{{- end }}
{{- with (include "backend.controller.volumes" . | trim) }}
volumes:
{{- nindent 2 . }}
{{- end }}
{{- with .Values.backend.hostAliases }}
2023-02-15 06:55:36 +05:30
hostAliases:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.backend.nodeSelector }}
2023-02-15 06:55:36 +05:30
nodeSelector:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.backend.affinity }}
2023-02-15 06:55:36 +05:30
affinity:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.backend.topologySpreadConstraints }}
2023-02-15 06:55:36 +05:30
topologySpreadConstraints:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.backend.tolerations }}
2023-02-15 06:55:36 +05:30
tolerations:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}