GuangrongFu | cc1316b | 2021-02-03 17:29:08 +0800 | [diff] [blame] | 1 | {{/* |
| 2 | #============LICENSE_START======================================================== |
| 3 | # ================================================================================ |
| 4 | # Copyright (c) 2021 ZTE Intellectual Property. All rights reserved. |
| 5 | # ================================================================================ |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # ============LICENSE_END========================================================= |
| 18 | */}} |
| 19 | |
| 20 | apiVersion: apps/v1 |
| 21 | kind: Deployment |
| 22 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
Guangrong Fu | b189f5f | 2022-01-24 15:07:08 +0800 | [diff] [blame] | 23 | {{- $sum := "" }} |
| 24 | {{- range $path, $bytes := .Files.Glob "resources/config/*.json"}} |
| 25 | {{- $sum = $.Files.Get $path | sha256sum | print $sum }} |
| 26 | {{- end }} |
| 27 | annotations: |
| 28 | checksum/config: {{ $sum | sha256sum }} |
| 29 | |
GuangrongFu | cc1316b | 2021-02-03 17:29:08 +0800 | [diff] [blame] | 30 | spec: |
| 31 | replicas: 1 |
| 32 | selector: {{- include "common.selectors" . | nindent 4 }} |
| 33 | template: |
| 34 | metadata: {{- include "common.templateMetadata" . | nindent 6 }} |
| 35 | spec: |
Andreas Geissler | 4a5c1bd | 2023-03-01 11:23:32 +0100 | [diff] [blame] | 36 | initContainers: |
Andreas Geissler | f51bbef | 2023-03-31 12:07:23 +0200 | [diff] [blame] | 37 | {{- if .Values.global.postgres.localCluster }} |
| 38 | {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }} |
| 39 | {{ else }} |
| 40 | {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }} |
Andreas Geissler | 4a5c1bd | 2023-03-01 11:23:32 +0100 | [diff] [blame] | 41 | {{- end }} |
GuangrongFu | cc1316b | 2021-02-03 17:29:08 +0800 | [diff] [blame] | 42 | - name: {{ include "common.name" . }}-env-config |
| 43 | image: {{ include "repositoryGenerator.image.envsubst" . }} |
| 44 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 45 | command: |
| 46 | - sh |
| 47 | args: |
| 48 | - -c |
| 49 | - "cd /hemconfig && for PFILE in `find . -type f -not -name '*.json'`; do envsubst < ${PFILE} > /config/${PFILE##*/}; done" |
| 50 | env: |
| 51 | - name: JDBC_USERNAME |
| 52 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }} |
| 53 | - name: JDBC_PASSWORD |
| 54 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} |
| 55 | - name: DB_NAME |
| 56 | value: {{ .Values.config.pgConfig.dbName }} |
| 57 | - name: URL_JDBC |
| 58 | value: {{ .Values.config.pgConfig.dbHost }} |
| 59 | - name: DB_PORT |
| 60 | value: "{{ .Values.config.pgConfig.dbPort }}" |
Guangrong Fu | 2d51104 | 2023-03-15 11:09:49 +0800 | [diff] [blame] | 61 | - name: AAI_ADDR |
| 62 | value: aai |
| 63 | - name: AAI_PORT |
| 64 | value: "{{ .Values.config.aai.aaiPort }}" |
| 65 | - name: AAI_USERNAME |
| 66 | value: {{ .Values.config.aai.username }} |
| 67 | - name: AAI_PASSWORD |
| 68 | value: {{ .Values.config.aai.password }} |
| 69 | - name: NAMESPACE |
| 70 | value: {{ include "common.namespace" . }} |
GuangrongFu | cc1316b | 2021-02-03 17:29:08 +0800 | [diff] [blame] | 71 | volumeMounts: |
| 72 | - mountPath: /hemconfig |
| 73 | name: {{ include "common.fullname" . }}-config |
| 74 | - mountPath: /config |
| 75 | name: {{ include "common.fullname" . }}-env-config |
| 76 | containers: |
| 77 | - name: {{ include "common.name" . }} |
| 78 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
| 79 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 80 | resources: {{ include "common.resources" . | nindent 10 }} |
| 81 | ports: {{ include "common.containerPorts" . | nindent 10 }} |
Andreas Geissler | 4a5c1bd | 2023-03-01 11:23:32 +0100 | [diff] [blame] | 82 | volumeMounts: |
GuangrongFu | cc1316b | 2021-02-03 17:29:08 +0800 | [diff] [blame] | 83 | - name: {{ include "common.fullname" . }}-env-config |
| 84 | mountPath: /opt/hemconfig |
Guangrong Fu | b189f5f | 2022-01-24 15:07:08 +0800 | [diff] [blame] | 85 | - name: {{ include "common.fullname" . }}-config |
| 86 | mountPath: /opt/hemtopics |
GuangrongFu | cc1316b | 2021-02-03 17:29:08 +0800 | [diff] [blame] | 87 | # disable liveness probe when breakpoints set in debugger |
| 88 | # so K8s doesn't restart unresponsive container |
| 89 | {{- if eq .Values.liveness.enabled true }} |
| 90 | livenessProbe: |
| 91 | httpGet: |
| 92 | path: {{ .Values.liveness.path }} |
| 93 | port: {{ .Values.liveness.port }} |
| 94 | scheme: {{ .Values.liveness.scheme }} |
| 95 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 96 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 97 | {{- end }} |
| 98 | readinessProbe: |
| 99 | httpGet: |
| 100 | path: {{ .Values.readiness.path }} |
| 101 | port: {{ .Values.readiness.port }} |
| 102 | scheme: {{ .Values.readiness.scheme }} |
| 103 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 104 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 105 | failureThreshold: 1 |
| 106 | successThreshold: 1 |
| 107 | timeoutSeconds: 1 |
| 108 | env: |
| 109 | - name: CONSUL_HOST |
| 110 | value: consul-server.{{ include "common.namespace" . }} |
| 111 | - name: CONFIG_BINDING_SERVICE |
| 112 | value: config-binding-service |
Guangrong Fu | b4d9212 | 2022-03-03 20:48:16 +0800 | [diff] [blame] | 113 | - name: MSB_IAG_SERVICE_PROTOCOL |
| 114 | value: {{ .Values.global.msbProtocol }} |
| 115 | - name: MSB_IAG_SERVICE_HOST |
| 116 | value: {{ .Values.global.msbServiceName }}.{{ include "common.namespace" . }} |
| 117 | - name: MSB_IAG_SERVICE_PORT |
| 118 | value: {{ .Values.global.msbPort | quote }} |
GuangrongFu | cc1316b | 2021-02-03 17:29:08 +0800 | [diff] [blame] | 119 | - name: POD_IP |
| 120 | valueFrom: |
| 121 | fieldRef: |
| 122 | apiVersion: v1 |
| 123 | fieldPath: status.podIP |
| 124 | - name: PGPASSWORD |
| 125 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} |
| 126 | - name: JDBC_USERNAME |
| 127 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }} |
| 128 | - name: JDBC_PASSWORD |
| 129 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} |
| 130 | - name: DB_NAME |
| 131 | value: {{ .Values.config.pgConfig.dbName }} |
| 132 | - name: URL_JDBC |
| 133 | value: {{ .Values.config.pgConfig.dbHost }} |
| 134 | - name: DB_PORT |
| 135 | value: "{{ .Values.config.pgConfig.dbPort }}" |
farida azmy | 1e05f29 | 2021-10-03 13:22:55 +0200 | [diff] [blame] | 136 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
Andreas Geissler | 4a5c1bd | 2023-03-01 11:23:32 +0100 | [diff] [blame] | 137 | volumes: |
GuangrongFu | cc1316b | 2021-02-03 17:29:08 +0800 | [diff] [blame] | 138 | - name: {{ include "common.fullname" . }}-config |
| 139 | configMap: |
| 140 | defaultMode: 422 |
| 141 | name: {{ include "common.fullname" . }} |
| 142 | - name: {{ include "common.fullname" . }}-env-config |
| 143 | emptyDir: |
| 144 | medium: Memory |
Andreas Geissler | bd0d31a | 2024-03-20 09:51:32 +0100 | [diff] [blame] | 145 | {{- include "common.imagePullSecrets" . | nindent 6 }} |