egernug | d3c55ab | 2023-01-19 15:50:37 +0000 | [diff] [blame] | 1 | # Copyright © 2023 Nordix Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | apiVersion: apps/v1 |
| 16 | kind: Deployment |
| 17 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
| 18 | spec: |
| 19 | selector: {{- include "common.selectors" . | nindent 4 }} |
| 20 | replicas: {{ index .Values.replicaCount }} |
| 21 | minReadySeconds: {{ index .Values.minReadySeconds }} |
| 22 | strategy: |
| 23 | type: {{ index .Values.updateStrategy.type }} |
| 24 | rollingUpdate: |
| 25 | maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }} |
| 26 | maxSurge: {{ index .Values.updateStrategy.maxSurge }} |
| 27 | template: |
| 28 | metadata: {{- include "common.templateMetadata" . | nindent 6 }} |
| 29 | spec: |
| 30 | containers: |
| 31 | - name: {{ include "common.name" . }} |
| 32 | command: [ "./start-app.sh" ] |
| 33 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
| 34 | resources: {{ include "common.resources" . | nindent 12 }} |
| 35 | env: |
| 36 | - name: DB_HOST |
| 37 | value: {{ include "common.mariadbService" . }} |
| 38 | - name: DB_PORT |
| 39 | value: {{ include "common.mariadbPort" . | quote }} |
| 40 | - name: DB_USERNAME |
| 41 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 14 }} |
| 42 | - name: DB_PASSWORD |
| 43 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 14 }} |
| 44 | - name: DB_ADMIN_USERNAME |
| 45 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 14 }} |
| 46 | - name: DB_ADMIN_PASSWORD |
| 47 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 14 }} |
| 48 | envFrom: |
| 49 | - configMapRef: |
| 50 | name: {{ include "common.fullname" . }}-configmap |
| 51 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 52 | volumeMounts: |
| 53 | - name: logs |
| 54 | mountPath: /app/logs |
| 55 | - name: config |
| 56 | mountPath: /app/config |
| 57 | readOnly: true |
| 58 | livenessProbe: |
| 59 | tcpSocket: |
| 60 | port: {{ index .Values.livenessProbe.port }} |
| 61 | initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}} |
| 62 | periodSeconds: {{ index .Values.livenessProbe.periodSeconds}} |
| 63 | successThreshold: {{ index .Values.livenessProbe.successThreshold}} |
| 64 | failureThreshold: {{ index .Values.livenessProbe.failureThreshold}} |
| 65 | ports: {{ include "common.containerPorts" . | nindent 12 }} |
| 66 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
| 67 | volumes: |
| 68 | - name: logs |
| 69 | emptyDir: {} |
| 70 | - name: config |
| 71 | configMap: |
| 72 | name: {{ include "common.fullname" . }}-app-configmap |
| 73 | imagePullSecrets: |
| 74 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |