d5d496f36baef47b4cd63146adb54b08c743ef49
[oom.git] / kubernetes / sdnc / components / ueb-listener / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16
17 apiVersion: apps/v1
18 kind: Deployment
19 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
20 spec:
21   replicas: {{ .Values.replicaCount }}
22   selector: {{- include "common.selectors" . | nindent 4 }}
23   template:
24     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
25     spec:
26       initContainers:
27       - command:
28         - sh
29         args:
30         - -c
31         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
32         env:
33         - name: SDNC_DB_USER
34           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
35         - name: SDNC_DB_PASSWORD
36           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
37         - name: UEB_USER
38           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ueb-creds" "key" "login") | indent 10 }}
39         - name: UEB_PASSWORD
40           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ueb-creds" "key" "password") | indent 10 }}
41         - name: ODL_USER
42           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 10 }}
43         - name: ODL_PASSWORD
44           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 10 }}
45         volumeMounts:
46         - mountPath: /config-input
47           name: config-input
48         - mountPath: /config
49           name: properties
50         image: {{ include "repositoryGenerator.image.envsubst" . }}
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52         name: {{ include "common.name" . }}-update-config
53       - command:
54         - /app/ready.py
55         args:
56         - --service-name
57         - {{ include "common.mariadbService" . }}
58         - --service-name
59         - {{ .Values.config.sdncChartName }}
60         - --service-name
61         - {{ .Values.config.sdcbeChartName }}
62         - --service-name
63         - {{ .Values.config.msgRouterContainerName }}
64         env:
65         - name: NAMESPACE
66           valueFrom:
67             fieldRef:
68               apiVersion: v1
69               fieldPath: metadata.namespace
70         image: {{ include "repositoryGenerator.image.readiness" . }}
71         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72         name: {{ include "common.name" . }}-readiness
73         resources:
74           limits:
75             cpu: "100m"
76             memory: "500Mi"
77           requests:
78             cpu: "3m"
79             memory: "20Mi"
80       containers:
81       - command:
82         - /opt/onap/sdnc/ueb-listener/bin/start-ueb-listener.sh
83         name: {{ include "common.name" . }}
84         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
85         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
86         env:
87         - name: PROPERTY_DIR
88           value: "{{ .Values.config.configDir }}"
89         - name: SDNC_CONFIG_DIR
90           value: "{{ .Values.config.configDir }}"
91         - name: LOG4J_FORMAT_MSG_NO_LOOKUPS
92           value: "true"
93         - name: SASL_JAAS_CONFIG
94           valueFrom:
95             secretKeyRef:
96               name: {{ include "common.name" . }}-ku
97               key: sasl.jaas.config
98         volumeMounts:
99         - mountPath: /etc/localtime
100           name: localtime
101           readOnly: true
102         - mountPath: {{ .Values.config.configDir }}/dblib.properties
103           name: properties
104           subPath: dblib.properties
105         - mountPath: {{ .Values.config.configDir }}/ueb-listener.properties
106           name: properties
107           subPath: ueb-listener.properties
108         - mountPath: {{ .Values.config.configDir }}/log4j2.xml
109           name: properties
110           subPath: log4j2.xml
111         resources: {{ include "common.resources" . | nindent 10 }}
112         ports: {{ include "common.containerPorts" . | nindent 10  }}
113       {{- if .Values.nodeSelector }}
114       nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
115       {{- end }}
116       {{- if .Values.affinity }}
117       affinity: {{ toYaml .Values.affinity | nindent 8 }}
118       {{- end }}
119       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
120       volumes:
121         - name: localtime
122           hostPath:
123             path: /etc/localtime
124         - name: config-input
125           configMap:
126             name: {{ include "common.fullname" . }}
127             defaultMode: 0644
128         - name: properties
129           emptyDir:
130             medium: Memory
131       {{- include "common.imagePullSecrets" . | nindent 6 }}