blob: aef0c8c22a2e98f7883a5165100349161636a1e7 [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/config/*.json"}}
25{{- $sum = $.Files.Get $path | sha256sum | print $sum }}
26{{- end }}
27 annotations:
28 checksum/config: {{ $sum | sha256sum }}
29
GuangrongFucc1316b2021-02-03 17:29:08 +080030spec:
31 replicas: 1
32 selector: {{- include "common.selectors" . | nindent 4 }}
33 template:
34 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
35 spec:
36 initContainers: {{- include "common.certInitializer.initContainer" . | nindent 6 }}
GuangrongFucc1316b2021-02-03 17:29:08 +080037 - name: {{ include "common.name" . }}-env-config
38 image: {{ include "repositoryGenerator.image.envsubst" . }}
39 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40 command:
41 - sh
42 args:
43 - -c
44 - "cd /hemconfig && for PFILE in `find . -type f -not -name '*.json'`; do envsubst < ${PFILE} > /config/${PFILE##*/}; done"
45 env:
46 - name: JDBC_USERNAME
47 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
48 - name: JDBC_PASSWORD
49 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
50 - name: DB_NAME
51 value: {{ .Values.config.pgConfig.dbName }}
52 - name: URL_JDBC
53 value: {{ .Values.config.pgConfig.dbHost }}
54 - name: DB_PORT
55 value: "{{ .Values.config.pgConfig.dbPort }}"
56 volumeMounts:
57 - mountPath: /hemconfig
58 name: {{ include "common.fullname" . }}-config
59 - mountPath: /config
60 name: {{ include "common.fullname" . }}-env-config
61 containers:
62 - name: {{ include "common.name" . }}
63 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
64 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65 resources: {{ include "common.resources" . | nindent 10 }}
66 ports: {{ include "common.containerPorts" . | nindent 10 }}
67 volumeMounts: {{- include "common.certInitializer.volumeMount" . | nindent 8 }}
68 - name: {{ include "common.fullname" . }}-env-config
69 mountPath: /opt/hemconfig
Guangrong Fub189f5f2022-01-24 15:07:08 +080070 - name: {{ include "common.fullname" . }}-config
71 mountPath: /opt/hemtopics
GuangrongFucc1316b2021-02-03 17:29:08 +080072 # disable liveness probe when breakpoints set in debugger
73 # so K8s doesn't restart unresponsive container
74 {{- if eq .Values.liveness.enabled true }}
75 livenessProbe:
76 httpGet:
77 path: {{ .Values.liveness.path }}
78 port: {{ .Values.liveness.port }}
79 scheme: {{ .Values.liveness.scheme }}
80 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
81 periodSeconds: {{ .Values.liveness.periodSeconds }}
82 {{- end }}
83 readinessProbe:
84 httpGet:
85 path: {{ .Values.readiness.path }}
86 port: {{ .Values.readiness.port }}
87 scheme: {{ .Values.readiness.scheme }}
88 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
89 periodSeconds: {{ .Values.readiness.periodSeconds }}
90 failureThreshold: 1
91 successThreshold: 1
92 timeoutSeconds: 1
93 env:
94 - name: CONSUL_HOST
95 value: consul-server.{{ include "common.namespace" . }}
96 - name: CONFIG_BINDING_SERVICE
97 value: config-binding-service
98 - name: msb_hostname
99 value: "msb-iag.onap"
100 - name: POD_IP
101 valueFrom:
102 fieldRef:
103 apiVersion: v1
104 fieldPath: status.podIP
105 - name: PGPASSWORD
106 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
107 - name: JDBC_USERNAME
108 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
109 - name: JDBC_PASSWORD
110 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
111 - name: DB_NAME
112 value: {{ .Values.config.pgConfig.dbName }}
113 - name: URL_JDBC
114 value: {{ .Values.config.pgConfig.dbHost }}
115 - name: DB_PORT
116 value: "{{ .Values.config.pgConfig.dbPort }}"
farida azmy1e05f292021-10-03 13:22:55 +0200117 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
GuangrongFucc1316b2021-02-03 17:29:08 +0800118 volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
119 - name: {{ include "common.fullname" . }}-config
120 configMap:
121 defaultMode: 422
122 name: {{ include "common.fullname" . }}
123 - name: {{ include "common.fullname" . }}-env-config
124 emptyDir:
125 medium: Memory
126 imagePullSecrets:
127 - name: "{{ include "common.namespace" . }}-docker-registry-key"