Merge "Casablanca sparky chart updates"
[oom.git] / kubernetes / aai / charts / aai-sparky-be / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
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: extensions/v1beta1
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: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   selector:
29     matchLabels:
30       app: {{ include "common.name" . }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ .Release.Name }}
36       name: {{ include "common.name" . }}
37     spec:
38       initContainers:
39       - command:
40         - /root/ready.py
41         args:
42         - --container-name
43         - aai-elasticsearch
44         - --container-name
45         - aai-search-data
46         - --container-name
47         - aai
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         name: {{ include "common.name" . }}-readiness
57       containers:
58       - name: {{ include "common.name" . }}
59         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
60         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61
62         volumeMounts:
63         - mountPath: /etc/localtime
64           name: localtime
65           readOnly: true
66         - mountPath: /opt/app/sparky/config/auth/
67           name: {{ include "common.fullname" . }}-auth-config
68
69         - mountPath: /opt/app/sparky/config/portal/
70           name: {{ include "common.fullname" . }}-portal-config
71
72         - mountPath: /opt/app/sparky/config/portal/BOOT-INF/classes/
73           name: {{ include "common.fullname" . }}-portal-config-props
74
75         - mountPath: /var/log/onap
76           name: {{ include "common.fullname" . }}-logs
77
78         - mountPath:  /opt/app/sparky/config/application.properties
79           name: {{ include "common.fullname" . }}-properties
80           subPath: application.properties
81
82         - mountPath:  /opt/app/sparky/config/application-resources.properties
83           name: {{ include "common.fullname" . }}-properties
84           subPath: application-resources.properties
85
86         - mountPath:  /opt/app/sparky/config/application-ssl.properties
87           name: {{ include "common.fullname" . }}-properties
88           subPath: application-ssl.properties
89
90         - mountPath:  /opt/app/sparky/config/application-oxm-default.properties
91           name: {{ include "common.fullname" . }}-properties
92           subPath: application-oxm-default.properties
93           
94         - mountPath:  /opt/app/sparky/config/application-oxm-override.properties
95           name: {{ include "common.fullname" . }}-properties
96           subPath: application-oxm-override.properties
97
98         - mountPath:  /opt/app/sparky/config/application-oxm-schema-prod.properties
99           name: {{ include "common.fullname" . }}-properties
100           subPath: application-oxm-schema-prod.properties
101         
102         ports:
103         - containerPort: {{ .Values.service.internalPort }}
104         - containerPort: {{ .Values.service.internalPort2 }}
105         # disable liveness probe when breakpoints set in debugger
106         # so K8s doesn't restart unresponsive container
107         {{- if eq .Values.liveness.enabled true }}
108         livenessProbe:
109           tcpSocket:
110             port: {{ .Values.service.internalPort }}
111           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
112           periodSeconds: {{ .Values.liveness.periodSeconds }}
113         {{ end -}}
114         readinessProbe:
115           tcpSocket:
116             port: {{ .Values.service.internalPort }}
117           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
118           periodSeconds: {{ .Values.readiness.periodSeconds }}
119         resources:
120 {{ toYaml .Values.resources | indent 10 }}
121       {{- if .Values.nodeSelector }}
122       nodeSelector:
123 {{ toYaml .Values.nodeSelector | indent 8 }}
124       {{- end -}}
125       {{- if .Values.affinity }}
126       affinity:
127 {{ toYaml .Values.affinity | indent 8 }}
128       {{- end }}
129
130       # side car containers
131       - name: filebeat-onap
132         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
133         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
134         volumeMounts:
135         - mountPath: /usr/share/filebeat/filebeat.yml
136           subPath: filebeat.yml
137           name: filebeat-conf
138         - mountPath: /var/log/onap
139           name: {{ include "common.fullname" . }}-logs
140         - mountPath: /usr/share/filebeat/data
141           name: aai-sparky-filebeat
142
143       volumes:
144       - name: localtime
145         hostPath:
146           path: /etc/localtime
147
148       - name: {{ include "common.fullname" . }}-properties
149         configMap:
150           name: {{ include "common.fullname" . }}-prop
151
152       - name: {{ include "common.fullname" . }}-config
153         configMap:
154           name: {{ include "common.fullname" . }}
155
156       - name: {{ include "common.fullname" . }}-portal-config
157         configMap:
158           name: {{ include "common.fullname" . }}-portal
159
160       - name: {{ include "common.fullname" . }}-portal-config-props
161         configMap:
162           name: {{ include "common.fullname" . }}-portal-props
163
164       - name: {{ include "common.fullname" . }}-auth-config
165         secret:
166           secretName: {{ include "common.fullname" . }}
167       - name: filebeat-conf
168         configMap:
169           name: aai-filebeat
170       - name: {{ include "common.fullname" . }}-logs
171         emptyDir: {}
172       - name: aai-sparky-filebeat
173         emptyDir: {}
174       - name: modeldir
175         emptyDir: {}
176       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
177       imagePullSecrets:
178       - name: "{{ include "common.namespace" . }}-docker-registry-key"