xudan16 | c7f36a6 | 2022-07-21 17:27:14 +0800 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright © 2022 Huawei Technologies Co., Ltd. All rights reserved. |
| 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 | |
| 16 | apiVersion: apps/v1 |
| 17 | kind: Deployment |
| 18 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
| 19 | spec: |
| 20 | selector: {{- include "common.selectors" . | nindent 4 }} |
| 21 | replicas: {{ .Values.replicaCount }} |
| 22 | template: |
| 23 | metadata: {{- include "common.templateMetadata" . | nindent 6 }} |
| 24 | spec: |
| 25 | initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }} |
| 26 | containers: |
| 27 | - name: {{ include "common.name" . }} |
| 28 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
| 29 | imagePullPolicy: {{ .Values.pullPolicy }} |
| 30 | command: ["sh", "-c"] |
| 31 | args: |
| 32 | - ". /uui/run.sh" |
| 33 | ports: {{ include "common.containerPorts" . | nindent 10 }} |
| 34 | env: |
| 35 | - name: POSTGRES_IP |
| 36 | value: {{ .Values.postgres.service.name2 }} |
| 37 | - name: POSTGRES_PORT |
| 38 | value: "{{ .Values.postgres.service.externalPort }}" |
| 39 | - name: POSTGRES_DB_NAME |
| 40 | value: {{ .Values.postgres.config.pgDatabase }} |
| 41 | - name: POSTGRES_USERNAME |
| 42 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }} |
| 43 | - name: POSTGRES_PASSWORD |
| 44 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} |
| 45 | {{- if eq .Values.liveness.enabled true }} |
| 46 | livenessProbe: |
| 47 | tcpSocket: |
| 48 | port: {{ .Values.liveness.port }} |
| 49 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 50 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 51 | {{- end }} |
| 52 | readinessProbe: |
| 53 | tcpSocket: |
| 54 | port: {{ .Values.readiness.port }} |
| 55 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 56 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 57 | resources: |
| 58 | {{ include "common.resources" . }} |
| 59 | {{- if .Values.nodeSelector }} |
| 60 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }} |
| 61 | {{- end }} |
| 62 | {{- if .Values.affinity }} |
| 63 | affinity: {{ toYaml .Values.affinity | nindent 10 }} |
| 64 | {{- end }} |
| 65 | volumeMounts: |
| 66 | - mountPath: /uui/run.sh |
| 67 | name: entrypoint |
| 68 | subPath: run.sh |
| 69 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
| 70 | volumes: |
| 71 | - name: entrypoint |
| 72 | configMap: |
| 73 | name: {{ include "common.fullname" . }}-entrypoint |
| 74 | defaultMode: 0755 |
| 75 | imagePullSecrets: |
| 76 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |