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