blob: f24d8eab6516fdcdffa5a5d773e19e6ec9f42ab1 [file] [log] [blame]
GuangrongFucc1316b2021-02-03 17:29:08 +08001{{/*
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
20apiVersion: apps/v1
21kind: Deployment
22metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
Guangrong Fub189f5f2022-01-24 15:07:08 +080023{{- $sum := "" }}
24{{- range $path, $bytes := .Files.Glob "resources/rules/*"}}
25{{- $sum = $.Files.Get $path | sha256sum | print $sum }}
26{{- end }}
27 annotations:
28 checksum/rules: {{ $sum | sha256sum }}
GuangrongFucc1316b2021-02-03 17:29:08 +080029spec:
30 replicas: 1
31 selector: {{- include "common.selectors" . | nindent 4 }}
32 template:
33 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
34 spec:
Andreas Geissler4a5c1bd2023-03-01 11:23:32 +010035 initContainers:
Andreas Geisslerf51bbef2023-03-31 12:07:23 +020036 {{- if .Values.global.postgres.localCluster }}
37 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }}
38 {{ else }}
39 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }}
Andreas Geissler4a5c1bd2023-03-01 11:23:32 +010040 {{- end }}
GuangrongFucc1316b2021-02-03 17:29:08 +080041 - name: {{ include "common.name" . }}-env-config
42 image: {{ include "repositoryGenerator.image.envsubst" . }}
43 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44 command:
45 - sh
46 args:
47 - -c
48 - "cd /hrmconfig && for PFILE in `find . -type f -not -name '*.json'`; do envsubst < ${PFILE} > /config/${PFILE##*/}; done"
49 env:
50 - name: JDBC_USERNAME
51 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
52 - name: JDBC_PASSWORD
53 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
54 - name: DB_NAME
55 value: {{ .Values.config.pgConfig.dbName }}
56 - name: URL_JDBC
57 value: {{ .Values.config.pgConfig.dbHost }}
58 - name: DB_PORT
59 value: "{{ .Values.config.pgConfig.dbPort }}"
Guangrong Fu2d511042023-03-15 11:09:49 +080060 - name: NAMESPACE
61 value: {{ include "common.namespace" . }}
GuangrongFucc1316b2021-02-03 17:29:08 +080062 volumeMounts:
63 - mountPath: /hrmconfig
Guangrong Fub189f5f2022-01-24 15:07:08 +080064 name: {{ include "common.fullname" . }}-general-config
GuangrongFucc1316b2021-02-03 17:29:08 +080065 - mountPath: /config
66 name: {{ include "common.fullname" . }}-env-config
67 containers:
68 - name: {{ include "common.name" . }}
69 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
70 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Andreas Geisslerbb28a942023-06-15 14:34:34 +020071 resources: {{ include "common.resources" . | nindent 10 }}
GuangrongFucc1316b2021-02-03 17:29:08 +080072 ports: {{ include "common.containerPorts" . | nindent 8 }}
Andreas Geissler4a5c1bd2023-03-01 11:23:32 +010073 volumeMounts:
GuangrongFucc1316b2021-02-03 17:29:08 +080074 - name: {{ include "common.fullname" . }}-env-config
75 mountPath: /opt/hrmconfig
Guangrong Fub189f5f2022-01-24 15:07:08 +080076 - name: {{ include "common.fullname" . }}-rule-config
77 mountPath: /opt/hrmrules
GuangrongFucc1316b2021-02-03 17:29:08 +080078 # disable liveness probe when breakpoints set in debugger
79 # so K8s doesn't restart unresponsive container
80 {{- if eq .Values.liveness.enabled true }}
81 livenessProbe:
82 httpGet:
83 path: {{ .Values.liveness.path }}
84 port: {{ .Values.liveness.port }}
85 scheme: {{ .Values.liveness.scheme }}
86 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
87 periodSeconds: {{ .Values.liveness.periodSeconds }}
88 {{- end }}
89 readinessProbe:
90 httpGet:
91 path: {{ .Values.readiness.path }}
92 port: {{ .Values.readiness.port }}
93 scheme: {{ .Values.readiness.scheme }}
94 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
95 periodSeconds: {{ .Values.readiness.periodSeconds }}
96 failureThreshold: 1
97 successThreshold: 1
98 timeoutSeconds: 1
99 env:
100 - name: CONSUL_HOST
101 value: consul-server.{{ include "common.namespace" . }}
102 - name: CONFIG_BINDING_SERVICE
103 value: config-binding-service
Guangrong Fub4d92122022-03-03 20:48:16 +0800104 - name: MSB_IAG_SERVICE_PROTOCOL
105 value: {{ .Values.global.msbProtocol }}
106 - name: MSB_IAG_SERVICE_HOST
107 value: {{ .Values.global.msbServiceName }}.{{ include "common.namespace" . }}
108 - name: MSB_IAG_SERVICE_PORT
109 value: {{ .Values.global.msbPort | quote}}
GuangrongFucc1316b2021-02-03 17:29:08 +0800110 - name: POD_IP
111 valueFrom:
112 fieldRef:
113 apiVersion: v1
114 fieldPath: status.podIP
115 - name: PGPASSWORD
116 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
117 - name: JDBC_USERNAME
118 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
119 - name: JDBC_PASSWORD
120 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
121 - name: DB_NAME
122 value: {{ .Values.config.pgConfig.dbName }}
123 - name: URL_JDBC
124 value: {{ .Values.config.pgConfig.dbHost }}
125 - name: DB_PORT
126 value: "{{ .Values.config.pgConfig.dbPort }}"
farida azmy1e05f292021-10-03 13:22:55 +0200127 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Andreas Geissler4a5c1bd2023-03-01 11:23:32 +0100128 volumes:
Guangrong Fub189f5f2022-01-24 15:07:08 +0800129 - name: {{ include "common.fullname" . }}-general-config
GuangrongFucc1316b2021-02-03 17:29:08 +0800130 configMap:
131 defaultMode: 422
Guangrong Fub189f5f2022-01-24 15:07:08 +0800132 name: {{ include "common.fullname" . }}-general-config
133 - name: {{ include "common.fullname" . }}-rule-config
134 configMap:
135 defaultMode: 422
136 name: {{ include "common.fullname" . }}-rule-config
GuangrongFucc1316b2021-02-03 17:29:08 +0800137 - name: {{ include "common.fullname" . }}-env-config
138 emptyDir:
139 medium: Memory
140 imagePullSecrets:
141 - name: "{{ include "common.namespace" . }}-docker-registry-key"