blob: 21a96568cbde00b3ba0be86137c66af2a5203ee5 [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:
35 initContainers: {{- include "common.certInitializer.initContainer" . | nindent 6 }}
GuangrongFucc1316b2021-02-03 17:29:08 +080036 - name: {{ include "common.name" . }}-env-config
37 image: {{ include "repositoryGenerator.image.envsubst" . }}
38 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
39 command:
40 - sh
41 args:
42 - -c
43 - "cd /hrmconfig && for PFILE in `find . -type f -not -name '*.json'`; do envsubst < ${PFILE} > /config/${PFILE##*/}; done"
44 env:
45 - name: JDBC_USERNAME
46 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
47 - name: JDBC_PASSWORD
48 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
49 - name: DB_NAME
50 value: {{ .Values.config.pgConfig.dbName }}
51 - name: URL_JDBC
52 value: {{ .Values.config.pgConfig.dbHost }}
53 - name: DB_PORT
54 value: "{{ .Values.config.pgConfig.dbPort }}"
55 volumeMounts:
56 - mountPath: /hrmconfig
Guangrong Fub189f5f2022-01-24 15:07:08 +080057 name: {{ include "common.fullname" . }}-general-config
GuangrongFucc1316b2021-02-03 17:29:08 +080058 - mountPath: /config
59 name: {{ include "common.fullname" . }}-env-config
60 containers:
61 - name: {{ include "common.name" . }}
62 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
63 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64 ports: {{ include "common.containerPorts" . | nindent 8 }}
65 volumeMounts: {{- include "common.certInitializer.volumeMount" . | nindent 8 }}
66 - name: {{ include "common.fullname" . }}-env-config
67 mountPath: /opt/hrmconfig
Guangrong Fub189f5f2022-01-24 15:07:08 +080068 - name: {{ include "common.fullname" . }}-rule-config
69 mountPath: /opt/hrmrules
GuangrongFucc1316b2021-02-03 17:29:08 +080070 # disable liveness probe when breakpoints set in debugger
71 # so K8s doesn't restart unresponsive container
72 {{- if eq .Values.liveness.enabled true }}
73 livenessProbe:
74 httpGet:
75 path: {{ .Values.liveness.path }}
76 port: {{ .Values.liveness.port }}
77 scheme: {{ .Values.liveness.scheme }}
78 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
79 periodSeconds: {{ .Values.liveness.periodSeconds }}
80 {{- end }}
81 readinessProbe:
82 httpGet:
83 path: {{ .Values.readiness.path }}
84 port: {{ .Values.readiness.port }}
85 scheme: {{ .Values.readiness.scheme }}
86 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
87 periodSeconds: {{ .Values.readiness.periodSeconds }}
88 failureThreshold: 1
89 successThreshold: 1
90 timeoutSeconds: 1
91 env:
92 - name: CONSUL_HOST
93 value: consul-server.{{ include "common.namespace" . }}
94 - name: CONFIG_BINDING_SERVICE
95 value: config-binding-service
Guangrong Fub4d92122022-03-03 20:48:16 +080096 - name: MSB_IAG_SERVICE_PROTOCOL
97 value: {{ .Values.global.msbProtocol }}
98 - name: MSB_IAG_SERVICE_HOST
99 value: {{ .Values.global.msbServiceName }}.{{ include "common.namespace" . }}
100 - name: MSB_IAG_SERVICE_PORT
101 value: {{ .Values.global.msbPort | quote}}
GuangrongFucc1316b2021-02-03 17:29:08 +0800102 - name: POD_IP
103 valueFrom:
104 fieldRef:
105 apiVersion: v1
106 fieldPath: status.podIP
107 - name: PGPASSWORD
108 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
109 - name: JDBC_USERNAME
110 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
111 - name: JDBC_PASSWORD
112 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
113 - name: DB_NAME
114 value: {{ .Values.config.pgConfig.dbName }}
115 - name: URL_JDBC
116 value: {{ .Values.config.pgConfig.dbHost }}
117 - name: DB_PORT
118 value: "{{ .Values.config.pgConfig.dbPort }}"
farida azmy1e05f292021-10-03 13:22:55 +0200119 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
GuangrongFucc1316b2021-02-03 17:29:08 +0800120 volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
Guangrong Fub189f5f2022-01-24 15:07:08 +0800121 - name: {{ include "common.fullname" . }}-general-config
GuangrongFucc1316b2021-02-03 17:29:08 +0800122 configMap:
123 defaultMode: 422
Guangrong Fub189f5f2022-01-24 15:07:08 +0800124 name: {{ include "common.fullname" . }}-general-config
125 - name: {{ include "common.fullname" . }}-rule-config
126 configMap:
127 defaultMode: 422
128 name: {{ include "common.fullname" . }}-rule-config
GuangrongFucc1316b2021-02-03 17:29:08 +0800129 - name: {{ include "common.fullname" . }}-env-config
130 emptyDir:
131 medium: Memory
132 imagePullSecrets:
133 - name: "{{ include "common.namespace" . }}-docker-registry-key"