From a77ef4878e53cbde1dd761318dcbec0c00f21f14 Mon Sep 17 00:00:00 2001 From: Chi-En Wu Date: Wed, 15 Apr 2020 16:03:43 +0800 Subject: [PATCH] feat: add template `common.deployment` --- templates/_deployment.yaml | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 templates/_deployment.yaml diff --git a/templates/_deployment.yaml b/templates/_deployment.yaml new file mode 100644 index 0000000..e577e0b --- /dev/null +++ b/templates/_deployment.yaml @@ -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 -}}