Merge changes I6a379ec4,I982a75a9,Id8a84b79,I423294a5,Iefe3d89a
[oom.git] / kubernetes / so / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
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         - mariadb
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       containers:
49         - name: {{ .Chart.Name }}
50           command:
51           - /tmp/start-jboss-server.sh
52           image: "{{ .Values.repository | default .Values.global.repository }}/{{ .Values.image }}"
53           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54           ports:
55           - containerPort: {{ .Values.service.internalPort }}
56           - containerPort: {{ .Values.service.internalPort2 }}
57           - containerPort: {{ .Values.service.internalPort3 }}
58           - containerPort: {{ .Values.service.internalPort4 }}
59           - containerPort: {{ .Values.service.internalPort5 }}
60           # disable liveness probe when breakpoints set in debugger
61           # so K8s doesn't restart unresponsive container 
62           {{- if eq .Values.liveness.enabled true }}
63           livenessProbe:
64             tcpSocket:
65               port: {{ .Values.service.internalPort }}
66             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
67             periodSeconds: {{ .Values.liveness.periodSeconds }}
68           {{ end -}}
69           readinessProbe:
70             tcpSocket:
71               port: {{ .Values.service.internalPort }}
72             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
73             periodSeconds: {{ .Values.readiness.periodSeconds }}
74           env:
75             - name: JBOSS_DEBUG
76               value: {{ .Values.global.debugEnabled | default .Values.debugEnabled | quote }}
77           volumeMounts:
78           - mountPath: /etc/localtime
79             name: localtime
80             readOnly: true
81           - mountPath: /shared/
82             name: so
83           - mountPath: /tmp/start-jboss-server.sh
84             name: so-docker-files
85             subPath: start-jboss-server.sh
86           - mountPath: /opt/jboss/standalone/configuration/standalone-full-ha-mso.xml
87             name: so-config
88             subPath: standalone-full-ha-mso.xml
89
90           - mountPath: /var/log/onap
91             name: so-logs
92           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-po-adapter-config/logback.network.xml
93             name: so-logback
94             subPath: logback.network.xml
95           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-po-adapter-config/logback.tenant.xml
96             name: so-logback
97             subPath: logback.tenant.xml
98           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-po-adapter-config/logback.vnf.xml
99             name: so-logback
100             subPath: logback.vnf.xml
101           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-po-adapter-config/logback.vfc.xml
102             name: so-logback
103             subPath: logback.vfc.xml
104           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-api-handler-infra-config/logback.apihandler-infra.xml
105             name: so-logback
106             subPath: logback.apihandler-infra.xml
107           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-appc-adapter-config/logback.appc.xml
108             name: so-logback
109             subPath: logback.appc.xml
110           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-requests-db-adapter-config/logback.msorequestsdbadapter.xml
111             name: so-logback
112             subPath: logback.msorequestsdbadapter.xml
113           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-asdc-controller-config/logback.asdc.xml
114             name: so-logback
115             subPath: logback.asdc.xml
116           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-sdnc-adapter-config/logback.sdnc.xml
117             name: so-logback
118             subPath: logback.sdnc.xml
119           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-bpmn-config/logback.bpmn.xml
120             name: so-logback
121             subPath: logback.bpmn.xml
122           - mountPath: /var/berks-cookbooks/mso-config/files/default/mso-workflow-message-adapter-config/logback.workflow-message-adapter.xml
123             name: so-logback
124             subPath: logback.workflow-message-adapter.xml
125           resources:
126 {{ toYaml .Values.resources | indent 12 }}
127         {{- if .Values.nodeSelector }}
128         nodeSelector:
129 {{ toYaml .Values.nodeSelector | indent 10 }}
130         {{- end -}}
131         {{- if .Values.affinity }}
132         affinity:
133 {{ toYaml .Values.affinity | indent 10 }}
134         {{- end }}
135         
136         # side car containers
137         - name: filebeat-onap
138           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
139           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
140           volumeMounts:
141           - mountPath: /usr/share/filebeat/filebeat.yml
142             name: filebeat-conf
143             subPath: filebeat.yml
144           - mountPath: /var/log/onap
145             name: so-logs
146           - mountPath: /usr/share/filebeat/data
147             name: so-data-filebeat
148
149       volumes:
150         - name: localtime
151           hostPath:
152             path: /etc/localtime
153         - name: so-logback
154           configMap:
155             name: so-log-configmap
156         - name: filebeat-conf
157           configMap:
158             name: so-filebeat-configmap
159         - name: so
160           configMap:
161             name: so-configmap
162             items:
163             - key: mso-docker.json
164               path: mso-docker.json
165               mode: 0755
166             - key: aai.crt
167               path: aai.crt
168               mode: 0755
169             - key: encryption.key
170               path: encryption.key
171               mode: 0644
172         - name: so-config
173           configMap:
174             name: so-configmap
175             items:
176             - key: standalone-full-ha-mso.xml
177               path: standalone-full-ha-mso.xml
178               mode: 0644
179         - name: so-logs
180           emptyDir: {}
181         - name: so-data-filebeat
182           emptyDir: {}
183         - name: so-docker-files
184           configMap:
185             name: so-docker-file-configmap
186             items:
187             - key: start-jboss-server.sh
188               path: start-jboss-server.sh
189               mode: 0755
190       imagePullSecrets:
191       - name: "{{ include "common.namespace" . }}-docker-registry-key"
192