Merge "Add FCAPS to oom"
[oom.git] / kubernetes / oof / charts / oof-cmso / charts / oof-cmso-service / templates / deployment.yaml
1 # Copyright (c) 2018 AT&T
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       initContainers:
34       - command:
35         - /root/ready.py
36         args:
37         - --container-name
38         - {{ .Values.mariadb.nameOverride }}
39         env:
40         - name: NAMESPACE
41           valueFrom:
42             fieldRef:
43               apiVersion: v1
44               fieldPath: metadata.namespace
45         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
46         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47         name: {{ include "common.name" . }}-readiness
48       - name: db-init
49         image: "{{ include "common.repository" . }}/{{ .Values.dbinit.image }}"
50         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51         env:
52         - name: DB_HOST
53           value: {{ .Values.config.db_host }}.{{.Release.Namespace}}
54         - name: DB_PORT
55           value: {{ .Values.config.db_port | quote}}
56         - name: DB_USERNAME
57           value: {{ .Values.config.db_root }}
58         - name: DB_SCHEMA
59           value: {{ .Values.config.mysqlDatabase }}
60         - name: DB_PASSWORD
61           valueFrom:
62             secretKeyRef:
63               name: {{ .Release.Name}}-cmso-db
64               key: db-root-password
65         terminationMessagePolicy: File
66         volumeMounts:
67         - name: {{ include "common.fullname" . }}-config
68           mountPath: /share/etc/config
69         - name: {{ include "common.fullname" . }}-logs
70           mountPath: /share/logs
71       containers:
72       # side car containers
73       - name: filebeat-onap
74         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
75         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
76         volumeMounts:
77         - mountPath: /usr/share/filebeat/filebeat.yml
78           subPath: filebeat.yml
79           name: filebeat-conf
80         - mountPath: /var/log/onap
81           name: {{ include "common.fullname" . }}-logs
82         - mountPath: /usr/share/filebeat/data
83           name: {{ include "common.fullname" . }}-filebeat
84         resources:
85 {{ include "common.resources" . }}
86       - name: mso-simulator
87         image: "{{ .Values.global.pythonRepository }}/{{ .Values.global.pythonImage }}"
88         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
89         volumeMounts:
90         - name: {{ include "common.fullname" . }}-config
91           mountPath: /share/etc/config
92         command:
93         - /bin/sh
94         args:
95         - -x
96         - /share/etc/config/msosimulator.sh
97         ports:
98         - containerPort: 5000        
99         resources:
100 {{ include "common.resources" . }}
101       - name: {{ include "common.name" . }}
102         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
103         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
104         env:
105         - name: DB_HOST
106           value: {{ .Values.config.db_host }}.{{.Release.Namespace}}
107         - name: DB_PORT
108           value: {{ .Values.config.db_port | quote}}
109         - name: DB_USERNAME
110           value: {{ .Values.config.db_user }}
111         - name: DB_SCHEMA
112           value: {{ .Values.config.mysqlDatabase }}
113         - name: DB_PASSWORD
114           valueFrom:
115             secretKeyRef:
116               name: {{ .Release.Name}}-cmso-db
117               key: user-password
118         - name: JAVA_TRUSTSTORE
119           value: /share/etc/certs/{{ .Values.global.truststoreFile }}
120         - name: SSL_KEYSTORE
121           value: /share/etc/certs/{{ .Values.global.keystoreFile }}
122         - name: JAVA_TRUSTSTORE_PASSWORD
123           value: {{ .Values.global.truststorePassword }}
124         - name: SSL_KEYSTORE_PASSWORD
125           value: {{ .Values.global.keystorePassword }}
126         - name: AUTHENTICATION
127           value: {{ .Values.global.authentication }}
128         ports:
129         - containerPort: {{ .Values.service.internalPort }}
130         # disable liveness probe when breakpoints set in debugger
131         # so K8s doesn't restart unresponsive container
132         {{- if eq .Values.liveness.enabled true }}
133         livenessProbe:
134           tcpSocket:
135             port: {{ .Values.service.internalPort }}
136           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
137           periodSeconds: {{ .Values.liveness.periodSeconds }}
138         {{ end -}}
139         readinessProbe:
140           tcpSocket:
141             port: {{ .Values.service.internalPort }}
142           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
143           periodSeconds: {{ .Values.readiness.periodSeconds }}
144         volumeMounts:
145         - name: {{ include "common.fullname" . }}-logs
146           mountPath: /share/logs
147         - name: {{ include "common.fullname" . }}-logs
148           mountPath: /share/debug-logs
149         - name: {{ include "common.fullname" . }}-config
150           mountPath: /share/etc/config
151         - name: {{ include "common.fullname" . }}-certs
152           mountPath: /share/etc/certs
153         - name: {{ include "common.fullname" . }}-certs
154           mountPath: /opt/app/cmso/src/main/resources/aaf
155         resources:
156 {{ include "common.resources" . | indent 12 }}
157         {{- if .Values.nodeSelector }}
158         nodeSelector:
159 {{ toYaml .Values.nodeSelector | indent 10 }}
160         {{- end -}}
161         {{- if .Values.affinity }}
162         affinity:
163 {{ toYaml .Values.affinity | indent 10 }}
164         {{- end }}
165       volumes:
166         - name: {{ include "common.fullname" . }}-config
167           configMap:
168             name: {{ include "common.fullname" . }}
169             items:
170             - key: logback.xml
171               path: logback.xml
172             - key: cmso.properties
173               path: cmso.properties
174             - key: cadi.properties
175               path: cadi.properties
176             - key: optimizer.properties
177               path: optimizer.properties
178             - key: ticketmgt.properties
179               path: ticketmgt.properties
180             - key: liquibase.properties
181               path: liquibase.properties
182             - key: mock.py
183               path: mock.py
184             - key: msosimulator.sh
185               path: msosimulator.sh
186         - name:  {{ include "common.fullname" . }}-logs
187           emptyDir: {}
188         - name: {{ include "common.fullname" . }}-filebeat
189           emptyDir: {}
190         - name: filebeat-conf
191           configMap:
192             name: {{ .Release.Name }}-cmso-filebeat-configmap
193         - name: {{ include "common.fullname" . }}-certs
194           secret:
195             secretName: {{ .Release.Name }}-{{ .Values.global.commonConfigPrefix }}-certs
196       imagePullSecrets:
197       - name: "{{ include "common.namespace" . }}-docker-registry-key"