Merge "[PLATFORM] Add Oauth2-Proxy client to ONAP Realm"
[oom.git] / kubernetes / holmes / components / holmes-engine-mgmt / templates / deployment.yaml
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 }}
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
30 spec:
31   replicas: 1
32   selector: {{- include "common.selectors" . | nindent 4 }}
33   template:
34     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
35     spec:
36       initContainers:
37       {{- if not .Values.global.postgres.localCluster }}
38       {{ include "common.readinessCheck.waitFor" . | indent 6 | trim }}
39       {{- end }}
40       - name: {{ include "common.name" . }}-env-config
41         image: {{ include "repositoryGenerator.image.envsubst" . }}
42         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43         command:
44         - sh
45         args:
46         - -c
47         - "cd /hemconfig && for PFILE in `find . -type f -not -name '*.json'`; do envsubst < ${PFILE} > /config/${PFILE##*/}; done"
48         env:
49         - name: JDBC_USERNAME
50           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
51         - name: JDBC_PASSWORD
52           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
53         - name: DB_NAME
54           value: {{ .Values.config.pgConfig.dbName }}
55         - name: URL_JDBC
56           value: {{ .Values.config.pgConfig.dbHost }}
57         - name: DB_PORT
58           value: "{{ .Values.config.pgConfig.dbPort }}"
59         - name: AAI_ADDR
60           value: aai
61         - name: AAI_PORT
62           value: "{{ .Values.config.aai.aaiPort }}"
63         - name: AAI_USERNAME
64           value: {{ .Values.config.aai.username }}
65         - name: AAI_PASSWORD
66           value: {{ .Values.config.aai.password }}
67         - name: NAMESPACE
68           value: {{ include "common.namespace" . }}
69         volumeMounts:
70         - mountPath: /hemconfig
71           name: {{ include "common.fullname" . }}-config
72         - mountPath: /config
73           name: {{ include "common.fullname" . }}-env-config
74       containers:
75       - name: {{ include "common.name" . }}
76         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
77         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78         resources: {{ include "common.resources" . | nindent 10 }}
79         ports: {{ include "common.containerPorts" . | nindent 10  }}
80         volumeMounts:
81         - name: {{ include "common.fullname" . }}-env-config
82           mountPath: /opt/hemconfig
83         - name: {{ include "common.fullname" . }}-config
84           mountPath: /opt/hemtopics
85         # disable liveness probe when breakpoints set in debugger
86         # so K8s doesn't restart unresponsive container
87         {{- if eq .Values.liveness.enabled true }}
88         livenessProbe:
89           httpGet:
90             path: {{ .Values.liveness.path }}
91             port: {{ .Values.liveness.port }}
92             scheme: {{ .Values.liveness.scheme }}
93           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
94           periodSeconds: {{ .Values.liveness.periodSeconds }}
95         {{- end }}
96         readinessProbe:
97           httpGet:
98             path: {{ .Values.readiness.path }}
99             port: {{ .Values.readiness.port }}
100             scheme: {{ .Values.readiness.scheme }}
101           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
102           periodSeconds: {{ .Values.readiness.periodSeconds }}
103           failureThreshold: 1
104           successThreshold: 1
105           timeoutSeconds: 1
106         env:
107         - name: CONSUL_HOST
108           value: consul-server.{{ include "common.namespace" . }}
109         - name: CONFIG_BINDING_SERVICE
110           value: config-binding-service
111         - name: MSB_IAG_SERVICE_PROTOCOL
112           value: {{ .Values.global.msbProtocol }}
113         - name: MSB_IAG_SERVICE_HOST
114           value: {{ .Values.global.msbServiceName }}.{{ include "common.namespace" . }}
115         - name: MSB_IAG_SERVICE_PORT
116           value: {{ .Values.global.msbPort | quote }}
117         - name: POD_IP
118           valueFrom:
119             fieldRef:
120               apiVersion: v1
121               fieldPath: status.podIP
122         - name: PGPASSWORD
123           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
124         - name: JDBC_USERNAME
125           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
126         - name: JDBC_PASSWORD
127           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
128         - name: DB_NAME
129           value: {{ .Values.config.pgConfig.dbName }}
130         - name: URL_JDBC
131           value: {{ .Values.config.pgConfig.dbHost }}
132         - name: DB_PORT
133           value: "{{ .Values.config.pgConfig.dbPort }}"
134       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
135       volumes:
136       - name: {{ include "common.fullname" . }}-config
137         configMap:
138           defaultMode: 422
139           name: {{ include "common.fullname" . }}
140       - name: {{ include "common.fullname" . }}-env-config
141         emptyDir:
142           medium: Memory
143       imagePullSecrets:
144       - name: "{{ include "common.namespace" . }}-docker-registry-key"