[Portal] Remove hardcoded cassandra password
[oom.git] / kubernetes / oof / charts / oof-cmso / charts / oof-cmso-service / templates / deployment.yaml
1 # Copyright (c) 2018 AT&T
2 # Copyright (C) 2020 Wipro Limited.
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 apiVersion: apps/v1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   replicas: {{ .Values.replicaCount }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36     spec:
37       initContainers:
38       - command:
39         - /app/ready.py
40         args:
41         - --container-name
42         - {{ .Values.config.db.container }}
43         env:
44         - name: NAMESPACE
45           valueFrom:
46             fieldRef:
47               apiVersion: v1
48               fieldPath: metadata.namespace
49         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
50         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51         name: {{ include "common.name" . }}-readiness
52       - name: {{ include "common.name" . }}-db-config-readiness
53         command:
54         - /app/ready.py
55         args:
56         - -j
57         - "{{ include "common.release" . }}-cmso-db-config-config-job"
58         env:
59         - name: NAMESPACE
60           valueFrom:
61             fieldRef:
62               apiVersion: v1
63               fieldPath: metadata.namespace
64         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
65         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66       - name: {{ include "common.name" . }}-chown
67         command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /share/"]
68         image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
69         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
70         volumeMounts:
71         - name: {{ include "common.fullname" . }}-logs
72           mountPath: /share/logs
73       - name: db-init
74         image: "{{ include "common.repository" . }}/{{ .Values.dbinit.image }}"
75         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
76         env:
77         - name: DB_HOST
78           value: {{ .Values.config.db.host }}.{{.Release.Namespace}}
79         - name: DB_PORT
80           value: {{ .Values.config.db.port | quote}}
81         - name: DB_USERNAME
82           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "login") | indent 10}}
83         - name: DB_SCHEMA
84           value: {{ .Values.config.db.mysqlDatabase }}
85         - name: DB_PASSWORD
86           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "password") | indent 10}}
87         terminationMessagePolicy: File
88         volumeMounts:
89         - name: {{ include "common.fullname" . }}-config
90           mountPath: /share/etc/config
91         - name: {{ include "common.fullname" . }}-logs
92           mountPath: /share/logs
93       containers:
94       # side car containers
95       - name: filebeat-onap
96         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
97         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
98         volumeMounts:
99         - mountPath: /usr/share/filebeat/filebeat.yml
100           subPath: filebeat.yml
101           name: filebeat-conf
102         - mountPath: /var/log/onap
103           name: {{ include "common.fullname" . }}-logs
104         - mountPath: /usr/share/filebeat/data
105           name: {{ include "common.fullname" . }}-filebeat
106         resources:
107 {{ include "common.resources" . }}
108       - name: mso-simulator
109         image: "{{ include "common.repository" . }}/{{ .Values.robotimage }}"
110         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
111         volumeMounts:
112         - name: {{ include "common.fullname" . }}-config
113           mountPath: /share/etc/config
114         ports:
115         - containerPort: 5000
116         resources:
117 {{ include "common.resources" . }}
118       - name: {{ include "common.name" . }}
119         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
120         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
121         env:
122         - name: DB_HOST
123           value: {{ .Values.config.db.host }}.{{.Release.Namespace}}
124         - name: DB_PORT
125           value: {{ .Values.config.db.port | quote}}
126         - name: DB_USERNAME
127           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "login") | indent 10}}
128         - name: DB_SCHEMA
129           value: {{ .Values.config.db.mysqlDatabase }}
130         - name: DB_PASSWORD
131           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "password") | indent 10}}
132         - name: JAVA_TRUSTSTORE
133           value: /share/etc/certs/{{ .Values.global.truststoreFile }}
134         - name: SSL_KEYSTORE
135           value: /share/etc/certs/{{ .Values.global.keystoreFile }}
136         - name: JAVA_TRUSTSTORE_PASSWORD
137           value: {{ .Values.global.truststorePassword }}
138         - name: SSL_KEYSTORE_PASSWORD
139           value: {{ .Values.global.keystorePassword }}
140         - name: AUTHENTICATION
141           value: {{ .Values.global.authentication }}
142         ports:
143         - containerPort: {{ .Values.service.internalPort }}
144         # disable liveness probe when breakpoints set in debugger
145         # so K8s doesn't restart unresponsive container
146         {{- if eq .Values.liveness.enabled true }}
147         livenessProbe:
148           tcpSocket:
149             port: {{ .Values.service.internalPort }}
150           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
151           periodSeconds: {{ .Values.liveness.periodSeconds }}
152         {{ end -}}
153         readinessProbe:
154           tcpSocket:
155             port: {{ .Values.service.internalPort }}
156           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
157           periodSeconds: {{ .Values.readiness.periodSeconds }}
158         volumeMounts:
159         - name: {{ include "common.fullname" . }}-logs
160           mountPath: /share/logs
161         - name: {{ include "common.fullname" . }}-logs
162           mountPath: /share/debug-logs
163         - name: {{ include "common.fullname" . }}-config
164           mountPath: /share/etc/config
165         - name: {{ include "common.fullname" . }}-certs
166           mountPath: /share/etc/certs
167         - name: {{ include "common.fullname" . }}-certs
168           mountPath: /opt/app/cmso/src/main/resources/aaf
169         resources:
170 {{ include "common.resources" . | indent 12 }}
171         {{- if .Values.nodeSelector }}
172         nodeSelector:
173 {{ toYaml .Values.nodeSelector | indent 10 }}
174         {{- end -}}
175         {{- if .Values.affinity }}
176         affinity:
177 {{ toYaml .Values.affinity | indent 10 }}
178         {{- end }}
179       volumes:
180         - name: {{ include "common.fullname" . }}-config
181           configMap:
182             name: {{ include "common.fullname" . }}
183             items:
184             - key: logback.xml
185               path: logback.xml
186             - key: cmso.properties
187               path: cmso.properties
188             - key: cadi.properties
189               path: cadi.properties
190             - key: optimizer.properties
191               path: optimizer.properties
192             - key: ticketmgt.properties
193               path: ticketmgt.properties
194             - key: liquibase.properties
195               path: liquibase.properties
196         - name:  {{ include "common.fullname" . }}-logs
197           emptyDir: {}
198         - name: {{ include "common.fullname" . }}-filebeat
199           emptyDir: {}
200         - name: filebeat-conf
201           configMap:
202             name: {{ include "common.release" . }}-cmso-filebeat-configmap
203         - name: {{ include "common.fullname" . }}-certs
204           secret:
205             secretName: {{ include "common.release" . }}-{{ .Values.global.commonConfigPrefix }}-certs
206       imagePullSecrets:
207       - name: "{{ include "common.namespace" . }}-docker-registry-key"