Files
common/templates/_pod.tpl
2020-04-27 09:40:34 +08:00

41 lines
1.1 KiB
Smarty

{{/* vim: set filetype=mustache: */}}
{{- define "common.pod.template.tpl" -}}
{{- $top := first . -}}
{{- $pod := index . 1 -}}
{{- $serviceAccount := index . 2 -}}
metadata:
{{- with $pod.podAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "common.selectorLabels" $top | nindent 4 }}
spec:
{{- with $pod.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 4 }}
{{- end }}
serviceAccountName: {{ include "common.serviceAccountName" (list $top $serviceAccount) }}
securityContext:
{{- toYaml $pod.podSecurityContext | nindent 4 }}
containers:
- {{- include "common.container" (list $top $pod) | nindent 6 }}
{{- with $pod.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $pod.affinity }}
affinity:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $pod.tolerations }}
tolerations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
{{- define "common.pod.template" -}}
{{- include "common.utils.merge" (append . "common.pod.template.tpl") -}}
{{- end -}}