apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "tasko.fullname" . }}-backend labels: {{- include "tasko.labels" . | nindent 4 }} app.kubernetes.io/component: backend spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "tasko.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: backend template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "tasko.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: backend spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "tasko.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} initContainers: - name: wait-for-postgres image: busybox:1.35 command: ['sh', '-c', 'until nc -z {{ include "tasko.fullname" . }}-db-headless {{ .Values.postgres.port | default 5432 }}; do echo waiting for postgres; sleep 2; done;'] containers: - name: backend securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.backend.image.pullPolicy }} ports: - name: http containerPort: {{ .Values.backend.service.targetPort }} protocol: TCP env: - name: DATABASE_URL valueFrom: secretKeyRef: name: {{ include "tasko.fullname" . }}-secrets key: database-url {{- range $key, $value := .Values.backend.env }} - name: {{ $key }} value: {{ $value | quote }} {{- end }} livenessProbe: httpGet: path: / port: http initialDelaySeconds: 30 periodSeconds: 10 readinessProbe: httpGet: path: / port: http initialDelaySeconds: 10 periodSeconds: 5 resources: {{- toYaml .Values.backend.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}