|
| 1 | +apiVersion: apps/v1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + name: {{ include "fair.backend.fullname" . }} |
| 5 | + labels: |
| 6 | + {{- include "fair.labels" . | nindent 4 }} |
| 7 | + app.kubernetes.io/component: backend |
| 8 | +spec: |
| 9 | + replicas: {{ .Values.backendReplicaCount }} |
| 10 | + selector: |
| 11 | + matchLabels: |
| 12 | + {{- include "fair.backend.selectorLabels" . | nindent 6 }} |
| 13 | + template: |
| 14 | + metadata: |
| 15 | + annotations: |
| 16 | + checksum/config: {{ include (print $.Template.BasePath "/backend/configmap.yaml") . | sha256sum }} |
| 17 | + {{- with .Values.backend.podAnnotations }} |
| 18 | + {{- toYaml . | nindent 8 }} |
| 19 | + {{- end }} |
| 20 | + labels: |
| 21 | + {{- include "fair.backend.selectorLabels" . | nindent 8 }} |
| 22 | + spec: |
| 23 | + {{- with .Values.imagePullSecrets }} |
| 24 | + imagePullSecrets: |
| 25 | + {{- toYaml . | nindent 8 }} |
| 26 | + {{- end }} |
| 27 | + serviceAccountName: {{ include "fair.serviceAccountName" . }} |
| 28 | + {{- with .Values.backend.podSecurityContext }} |
| 29 | + securityContext: |
| 30 | + {{- toYaml . | nindent 8 }} |
| 31 | + {{- end }} |
| 32 | + containers: |
| 33 | + - name: api |
| 34 | + image: {{ include "fair.backend.image" . }} |
| 35 | + imagePullPolicy: {{ .Values.image.backend.pullPolicy }} |
| 36 | + {{- with .Values.backend.command }} |
| 37 | + command: |
| 38 | + {{- toYaml . | nindent 12 }} |
| 39 | + {{- end }} |
| 40 | + ports: |
| 41 | + - name: http |
| 42 | + containerPort: {{ .Values.backend.port }} |
| 43 | + protocol: TCP |
| 44 | + envFrom: |
| 45 | + - configMapRef: |
| 46 | + name: {{ include "fair.backend.fullname" . }} |
| 47 | + {{- with .Values.backend.envFrom }} |
| 48 | + {{- toYaml . | nindent 12 }} |
| 49 | + {{- end }} |
| 50 | + env: |
| 51 | + - name: DATABASE_PASSWORD |
| 52 | + valueFrom: |
| 53 | + secretKeyRef: |
| 54 | + {{- if .Values.externalDatabase.existingSecret }} |
| 55 | + name: {{ .Values.externalDatabase.existingSecret }} |
| 56 | + key: {{ .Values.externalDatabase.existingSecretKey }} |
| 57 | + {{- else }} |
| 58 | + name: {{ include "fair.backend.fullname" . }}-db |
| 59 | + key: password |
| 60 | + {{- end }} |
| 61 | + - name: DATABASE_URL |
| 62 | + value: {{ include "fair.databaseUrl" . | quote }} |
| 63 | + {{- with .Values.backend.livenessProbe }} |
| 64 | + livenessProbe: |
| 65 | + {{- toYaml . | nindent 12 }} |
| 66 | + {{- end }} |
| 67 | + {{- with .Values.backend.readinessProbe }} |
| 68 | + readinessProbe: |
| 69 | + {{- toYaml . | nindent 12 }} |
| 70 | + {{- end }} |
| 71 | + {{- with .Values.backend.resources }} |
| 72 | + resources: |
| 73 | + {{- toYaml . | nindent 12 }} |
| 74 | + {{- end }} |
| 75 | + {{- with .Values.backend.securityContext }} |
| 76 | + securityContext: |
| 77 | + {{- toYaml . | nindent 12 }} |
| 78 | + {{- end }} |
| 79 | + {{- if .Values.backend.djangoQ.enabled }} |
| 80 | + - name: django-q |
| 81 | + image: {{ include "fair.backend.image" . }} |
| 82 | + imagePullPolicy: {{ .Values.image.backend.pullPolicy }} |
| 83 | + command: |
| 84 | + - python |
| 85 | + - manage.py |
| 86 | + - qcluster |
| 87 | + envFrom: |
| 88 | + - configMapRef: |
| 89 | + name: {{ include "fair.backend.fullname" . }} |
| 90 | + {{- with .Values.backend.envFrom }} |
| 91 | + {{- toYaml . | nindent 12 }} |
| 92 | + {{- end }} |
| 93 | + env: |
| 94 | + - name: DATABASE_PASSWORD |
| 95 | + valueFrom: |
| 96 | + secretKeyRef: |
| 97 | + {{- if .Values.externalDatabase.existingSecret }} |
| 98 | + name: {{ .Values.externalDatabase.existingSecret }} |
| 99 | + key: {{ .Values.externalDatabase.existingSecretKey }} |
| 100 | + {{- else }} |
| 101 | + name: {{ include "fair.backend.fullname" . }}-db |
| 102 | + key: password |
| 103 | + {{- end }} |
| 104 | + - name: DATABASE_URL |
| 105 | + value: {{ include "fair.databaseUrl" . | quote }} |
| 106 | + {{- with .Values.backend.djangoQ.resources }} |
| 107 | + resources: |
| 108 | + {{- toYaml . | nindent 12 }} |
| 109 | + {{- end }} |
| 110 | + {{- with .Values.backend.securityContext }} |
| 111 | + securityContext: |
| 112 | + {{- toYaml . | nindent 12 }} |
| 113 | + {{- end }} |
| 114 | + {{- end }} |
| 115 | + {{- with .Values.backend.nodeSelector }} |
| 116 | + nodeSelector: |
| 117 | + {{- toYaml . | nindent 8 }} |
| 118 | + {{- end }} |
| 119 | + {{- with .Values.backend.affinity }} |
| 120 | + affinity: |
| 121 | + {{- toYaml . | nindent 8 }} |
| 122 | + {{- end }} |
| 123 | + {{- with .Values.backend.tolerations }} |
| 124 | + tolerations: |
| 125 | + {{- toYaml . | nindent 8 }} |
| 126 | + {{- end }} |
0 commit comments