{{- if .Values.backend.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "movienight.fullname" . }}-backend labels: {{- include "movienight.componentLabels" (dict "root" . "component" "backend") | nindent 4 }} {{- with .Values.global.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: replicas: {{ .Values.backend.replicaCount }} selector: matchLabels: {{- include "movienight.componentSelectorLabels" (dict "root" . "component" "backend") | nindent 6 }} template: metadata: labels: {{- include "movienight.componentSelectorLabels" (dict "root" . "component" "backend") | nindent 8 }} {{- with .Values.backend.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.backend.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} spec: serviceAccountName: {{ include "movienight.serviceAccountName" . }} {{- with .Values.global.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.backend.podSecurityContext }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} {{- $postgresEnv := include "movienight.postgresEnv" . | trim }} containers: - name: backend image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}" imagePullPolicy: {{ .Values.backend.image.pullPolicy }} {{- with .Values.backend.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} ports: - name: http containerPort: {{ .Values.backend.service.port }} protocol: TCP {{- if .Values.backend.management.enabled }} - name: management containerPort: {{ .Values.backend.management.port }} protocol: TCP {{- end }} {{- if or $postgresEnv .Values.backend.env .Values.backend.management.enabled .Values.observability.enabled }} env: {{- if .Values.backend.management.enabled }} - name: MANAGEMENT_SERVER_PORT value: {{ .Values.backend.management.port | quote }} {{- end }} {{- if .Values.observability.enabled }} - name: MANAGEMENT_METRICS_TAGS_APPLICATION value: {{ .Values.observability.metrics.applicationTag | quote }} - name: HTTP_SERVER_REQUESTS_HISTOGRAM_ENABLED value: {{ .Values.observability.metrics.httpServerRequestsHistogram | quote }} {{- end }} {{- if $postgresEnv }} {{- $postgresEnv | nindent 12 }} {{- end }} {{- with .Values.backend.env }} {{- toYaml . | nindent 12 }} {{- end }} {{- end }} {{- with .Values.backend.envFrom }} envFrom: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.backend.startupProbe }} startupProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.backend.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.backend.readinessProbe }} readinessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.backend.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.backend.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.backend.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.backend.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}