Piped-Kubernetes/charts/apps/piped/templates/backend/deployment.yaml

49 lines
1.7 KiB
YAML

---
{{- if .Values.backend.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "backend.names.fullname" . }}
{{- with (merge (.Values.backend.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
labels: {{- toYaml . | nindent 4 }}
{{- end }}
{{- with (merge (.Values.backend.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
spec:
revisionHistoryLimit: {{ .Values.backend.revisionHistoryLimit }}
replicas: {{ .Values.backend.replicas }}
{{- $strategy := default "Recreate" .Values.backend.strategy }}
{{- if and (ne $strategy "Recreate") (ne $strategy "RollingUpdate") }}
{{- fail (printf "Not a valid strategy type for Deployment (%s)" $strategy) }}
{{- end }}
strategy:
type: {{ $strategy }}
{{- with .Values.backend.rollingUpdate }}
{{- if and (eq $strategy "RollingUpdate") (or .surge .unavailable) }}
rollingUpdate:
{{- with .unavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{- with .surge }}
maxSurge: {{ . }}
{{- end }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "backend.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with include ("backend.podAnnotations") . }}
annotations:
{{- . | nindent 8 }}
{{- end }}
labels:
{{- include "backend.labels.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "backend.controller.pod" . | nindent 6 }}
{{- end }}