|
| 1 | +apiVersion: apps/v1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + name: {{ include "cpnConsole.fullname" . }}-backend |
| 5 | + labels: |
| 6 | + {{- include "cpnConsole.backend.labels" . | nindent 4 }} |
| 7 | +spec: |
| 8 | + {{- if not .Values.backend.autoscaling.enabled }} |
| 9 | + replicas: {{ .Values.backend.replicaCount }} |
| 10 | + {{- end }} |
| 11 | + selector: |
| 12 | + matchLabels: |
| 13 | + {{- include "cpnConsole.backend.selectorLabels" . | nindent 6 }} |
| 14 | + strategy: |
| 15 | + type: {{ .Values.backend.strategy.type }} |
| 16 | + template: |
| 17 | + metadata: |
| 18 | + annotations: |
| 19 | + {{- include "checksum" (list $ "/backend/configmap.yaml") | nindent 8 }} |
| 20 | + {{- include "checksum" (list $ "/backend/secret.yaml") | nindent 8 }} |
| 21 | + {{- include "checksum" (list $ "/backend/scripts.yaml") | nindent 8 }} |
| 22 | + {{- if .Values.config.create }} |
| 23 | + {{- include "checksum" (list $ "/config.yaml") | nindent 8 }} |
| 24 | + {{- end }} |
| 25 | + {{- with .Values.backend.podAnnotations }} |
| 26 | + {{- toYaml . | nindent 8 }} |
| 27 | + {{- end }} |
| 28 | + labels: |
| 29 | + {{- include "cpnConsole.backend.selectorLabels" . | nindent 8 }} |
| 30 | + {{- with .Values.backend.podLabels }} |
| 31 | + {{- toYaml . | nindent 8 }} |
| 32 | + {{- end }} |
| 33 | + spec: |
| 34 | + {{- if and .Values.imageCredentials.username .Values.imageCredentials.password }} |
| 35 | + imagePullSecrets: |
| 36 | + - name: {{ include "cpnConsole.name" . }}-pullsecret |
| 37 | + {{- end }} |
| 38 | + serviceAccountName: {{ include "cpnConsole.backend.serviceAccountName" . }} |
| 39 | + securityContext: |
| 40 | + {{- toYaml .Values.backend.podSecurityContext | nindent 8 }} |
| 41 | + {{- if or .Values.backend.plugins .Values.backend.initContainers }} |
| 42 | + initContainers: |
| 43 | + {{- if and .Values.backend.plugins (len .Values.backend.plugins) }} |
| 44 | + - image: {{ .Values.backend.fetchContainer.image }} |
| 45 | + name: fetch-plugins |
| 46 | + imagePullPolicy: {{ .Values.backend.fetchContainer.pullPolicy }} |
| 47 | + {{- if .Values.backend.proxy.enabled }} |
| 48 | + env: |
| 49 | + {{- toYaml .Values.backend.proxy.env | nindent 8 }} |
| 50 | + {{- end }} |
| 51 | + envFrom: |
| 52 | + - configMapRef: |
| 53 | + name: {{ include "cpnConsole.fullname" . }}-backend |
| 54 | + - secretRef: |
| 55 | + name: {{ include "cpnConsole.fullname" . }}-backend |
| 56 | + {{- if .Values.backend.envFrom }} |
| 57 | + {{- toYaml .Values.backend.envFrom | nindent 8 }} |
| 58 | + {{- end }} |
| 59 | + command: |
| 60 | + - sh |
| 61 | + - /script/fetch |
| 62 | + volumeMounts: |
| 63 | + - name: fetch-script |
| 64 | + mountPath: /script |
| 65 | + - name: plugins |
| 66 | + mountPath: /plugins |
| 67 | + {{- end }} |
| 68 | + {{- if .Values.backend.initContainers }} |
| 69 | + {{- tpl (toYaml .Values.backend.initContainers) . | nindent 8 }} |
| 70 | + {{- end }} |
| 71 | + {{- end }} |
| 72 | + containers: |
| 73 | + - name: backend |
| 74 | + securityContext: |
| 75 | + {{- toYaml .Values.backend.container.securityContext | nindent 12 }} |
| 76 | + image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag | default .Chart.AppVersion }}" |
| 77 | + imagePullPolicy: {{ .Values.backend.image.pullPolicy }} |
| 78 | + {{- if .Values.backend.container.command }} |
| 79 | + command: |
| 80 | + {{- range .Values.backend.container.command }} |
| 81 | + - {{ . | quote }} |
| 82 | + {{- end }} |
| 83 | + {{- end }} |
| 84 | + {{- if .Values.backend.container.args }} |
| 85 | + args: |
| 86 | + {{- range .Values.backend.container.args }} |
| 87 | + - {{ . | quote }} |
| 88 | + {{- end }} |
| 89 | + {{- end }} |
| 90 | + ports: |
| 91 | + - containerPort: {{ .Values.backend.service.port }} |
| 92 | + protocol: TCP |
| 93 | + envFrom: |
| 94 | + - configMapRef: |
| 95 | + name: {{ include "cpnConsole.fullname" . }}-backend |
| 96 | + - secretRef: |
| 97 | + name: {{ include "cpnConsole.fullname" . }}-backend |
| 98 | + {{- if .Values.backend.envFrom }} |
| 99 | + {{- toYaml .Values.backend.envFrom | nindent 8 }} |
| 100 | + {{- end }} |
| 101 | + {{- if .Values.backend.startupProbe.enabled }} |
| 102 | + {{- if .Values.global.postgresql.cnpgSecretName }} |
| 103 | + env: |
| 104 | + - name: DB_URL |
| 105 | + valueFrom: |
| 106 | + secretKeyRef: |
| 107 | + name: {{ .Values.global.postgresql.cnpgSecretName }} |
| 108 | + key: uri |
| 109 | + {{- end }} |
| 110 | + startupProbe: |
| 111 | + httpGet: |
| 112 | + path: {{ .Values.backend.healthcheckPath }} |
| 113 | + port: {{ .Values.backend.container.port }} |
| 114 | + initialDelaySeconds: {{ .Values.backend.startupProbe.initialDelaySeconds }} |
| 115 | + successThreshold: {{ .Values.backend.startupProbe.successThreshold }} |
| 116 | + failureThreshold: {{ .Values.backend.startupProbe.failureThreshold }} |
| 117 | + periodSeconds: {{ .Values.backend.startupProbe.periodSeconds }} |
| 118 | + timeoutSeconds: {{ .Values.backend.startupProbe.timeoutSeconds }} |
| 119 | + {{- end }} |
| 120 | + {{- if .Values.backend.readinessProbe.enabled }} |
| 121 | + readinessProbe: |
| 122 | + httpGet: |
| 123 | + path: {{ .Values.backend.healthcheckPath }} |
| 124 | + port: {{ .Values.backend.container.port }} |
| 125 | + initialDelaySeconds: {{ .Values.backend.readinessProbe.initialDelaySeconds }} |
| 126 | + successThreshold: {{ .Values.backend.readinessProbe.successThreshold }} |
| 127 | + failureThreshold: {{ .Values.backend.readinessProbe.failureThreshold }} |
| 128 | + periodSeconds: {{ .Values.backend.readinessProbe.periodSeconds }} |
| 129 | + timeoutSeconds: {{ .Values.backend.readinessProbe.timeoutSeconds }} |
| 130 | + {{- end }} |
| 131 | + {{- if .Values.backend.livenessProbe.enabled }} |
| 132 | + livenessProbe: |
| 133 | + httpGet: |
| 134 | + path: {{ .Values.backend.healthcheckPath }} |
| 135 | + port: {{ .Values.backend.container.port }} |
| 136 | + initialDelaySeconds: {{ .Values.backend.livenessProbe.initialDelaySeconds }} |
| 137 | + successThreshold: {{ .Values.backend.livenessProbe.successThreshold }} |
| 138 | + failureThreshold: {{ .Values.backend.livenessProbe.failureThreshold }} |
| 139 | + periodSeconds: {{ .Values.backend.livenessProbe.periodSeconds }} |
| 140 | + timeoutSeconds: {{ .Values.backend.livenessProbe.timeoutSeconds }} |
| 141 | + {{- end }} |
| 142 | + {{- if .Values.backend.hostAliases }} |
| 143 | + hostAliases: |
| 144 | + {{- toYaml .Values.backend.hostAliases | nindent 8 }} |
| 145 | + {{- end }} |
| 146 | + resources: |
| 147 | + {{- toYaml .Values.backend.resources | nindent 10 }} |
| 148 | + volumeMounts: |
| 149 | + - name: config |
| 150 | + mountPath: /config |
| 151 | + {{- if .Values.backend.dbDataCm }} |
| 152 | + - name: imports |
| 153 | + mountPath: /app/dist/init/db/imports |
| 154 | + {{- end }} |
| 155 | + {{- if and .Values.backend.plugins (len .Values.backend.plugins) }} |
| 156 | + - name: plugins |
| 157 | + mountPath: /plugins |
| 158 | + {{- end }} |
| 159 | + {{- range $volumeMount := .Values.backend.extraVolumeMounts }} |
| 160 | + - name: {{ $volumeMount.name }} |
| 161 | + mountPath: {{ $volumeMount.mountPath }} |
| 162 | + {{- end }} |
| 163 | + {{- if .Values.backend.extraContainers }} |
| 164 | + {{- tpl (toYaml .Values.backend.extraContainers) . | nindent 8 }} |
| 165 | + {{- end }} |
| 166 | + {{- with .Values.backend.nodeSelector }} |
| 167 | + nodeSelector: |
| 168 | + {{- toYaml . | nindent 8 }} |
| 169 | + {{- end }} |
| 170 | + {{- with .Values.backend.affinity }} |
| 171 | + affinity: |
| 172 | + {{- toYaml . | nindent 8 }} |
| 173 | + {{- end }} |
| 174 | + {{- with .Values.backend.tolerations }} |
| 175 | + tolerations: |
| 176 | + {{- toYaml . | nindent 8 }} |
| 177 | + {{- end }} |
| 178 | + volumes: |
| 179 | + - name: config |
| 180 | + {{- if .Values.backend.extraCa.name }} |
| 181 | + projected: |
| 182 | + sources: |
| 183 | + - configMap: |
| 184 | + name: {{ .Values.backend.extraCa.name }} |
| 185 | + items: |
| 186 | + - key: {{ .Values.backend.extraCa.key }} |
| 187 | + path: {{ .Values.backend.extraCa.mountSubPath }} |
| 188 | + {{- end }} |
| 189 | + {{- if .Values.backend.dbDataCm }} |
| 190 | + - name: imports |
| 191 | + configMap: |
| 192 | + name: {{ .Values.backend.dbDataCm }} |
| 193 | + {{- end }} |
| 194 | + {{- if and .Values.backend.plugins (len .Values.backend.plugins) }} |
| 195 | + - name: plugins |
| 196 | + emptyDir: {} |
| 197 | + - name: fetch-script |
| 198 | + configMap: |
| 199 | + name: {{ include "cpnConsole.fullname" . }}-fetch-script |
| 200 | + {{- end }} |
| 201 | + {{- range $volume := .Values.backend.extraVolumes }} |
| 202 | + - name: {{ $volume.name }} |
| 203 | + {{- if eq $volume.type "hostPath" }} |
| 204 | + hostPath: |
| 205 | + path: {{ $volume.path }} |
| 206 | + {{- end }} |
| 207 | + {{- if eq $volume.type "configMap" }} |
| 208 | + configMap: |
| 209 | + name: {{ $volume.name }} |
| 210 | + {{- end }} |
| 211 | + {{- end }} |
0 commit comments