feat: add template common.deployment
This commit is contained in:
45
templates/_deployment.yaml
Normal file
45
templates/_deployment.yaml
Normal 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 -}}
|
Reference in New Issue
Block a user