feat: add template common.deployment

This commit is contained in:
Chi-En Wu
2020-04-15 16:03:43 +08:00
parent ca615dee81
commit a77ef4878e

View File

@ -0,0 +1,45 @@
{{/* vim: set filetype=mustache: */}}
{{- define "common.deployment.tpl" -}}
{{- $autoscaling := .Values.autoscaling | default (dict) -}}
apiVersion: apps/v1
kind: Deployment
{{ include "common.metadata" . }}
spec:
{{- if not $autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
{{- include "common.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "common.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "common.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- {{- include "common.container" . | nindent 10 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end -}}
{{- define "common.deployment" -}}
{{- include "common.utils.flattenCall" (list "common.utils.merge" . "common.deployment.tpl") -}}
{{- end -}}