Apache2 License addition
[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         env:
62         - name: CONFIG_HOME
63           value: /opt/app/sparky/appconfig/
64         - name: KEYSTORE_ALIAS_PASSWORD
65           value: {{ .Values.config.keystoreAliasPassword }}
66         - name: KEYSTORE_PASSWORD
67           value: {{ .Values.config.keyStorePassword }}
68         - name: SPARKY_SSL_ENABLED
69           value: 'false'
70         - name: SPARKY_PORTAL_ENABLED
71           value: 'false'
72         volumeMounts:
73         - mountPath: /etc/localtime
74           name: localtime
75           readOnly: true
76         - mountPath: /opt/app/sparky/appconfig/auth/
77           name: {{ include "common.fullname" . }}-auth-config
78         - mountPath: /opt/app/sparky/appconfig/camel-rests/
79           name: {{ include "common.fullname" . }}-camel-rests-config
80         - mountPath: /opt/app/sparky/appconfig/descriptors/
81           name: {{ include "common.fullname" . }}-descriptors-config
82         - mountPath: /opt/app/sparky/appconfig/filters/
83           name: {{ include "common.fullname" . }}-filters-config
84         - mountPath: /opt/app/sparky/appconfig/
85           name: {{ include "common.fullname" . }}-config
86         - mountPath: /opt/app/sparky/appconfig/portal
87           name: {{ include "common.fullname" . }}-portal-config
88         - mountPath: /opt/app/sparky/appconfig/portal/BOOT-INF/classes
89           name: {{ include "common.fullname" . }}-portal-boot-inf-config
90         - mountPath: /opt/app/sparky/appconfig/schemas
91           name: {{ include "common.fullname" . }}-schemas-config
92         - mountPath: /opt/app/sparky/appconfig/spring-beans/
93           name: {{ include "common.fullname" . }}-spring-beans-config
94         - mountPath: /var/log/onap
95           name: {{ include "common.fullname" . }}-logs
96         - mountPath: /opt/app/sparky/appconfig/logging/
97           name: {{ include "common.fullname" . }}-log-conf
98         ports:
99         - containerPort: {{ .Values.service.internalPort }}
100         - containerPort: {{ .Values.service.internalPort2 }}
101         # disable liveness probe when breakpoints set in debugger
102         # so K8s doesn't restart unresponsive container
103         {{- if eq .Values.liveness.enabled true }}
104         livenessProbe:
105           tcpSocket:
106             port: {{ .Values.service.internalPort }}
107           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
108           periodSeconds: {{ .Values.liveness.periodSeconds }}
109         {{ end -}}
110         readinessProbe:
111           tcpSocket:
112             port: {{ .Values.service.internalPort }}
113           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
114           periodSeconds: {{ .Values.readiness.periodSeconds }}
115         resources:
116 {{ toYaml .Values.resources | indent 10 }}
117       {{- if .Values.nodeSelector }}
118       nodeSelector:
119 {{ toYaml .Values.nodeSelector | indent 8 }}
120       {{- end -}}
121       {{- if .Values.affinity }}
122       affinity:
123 {{ toYaml .Values.affinity | indent 8 }}
124       {{- end }}
125
126       # side car containers
127       - name: filebeat-onap
128         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
129         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
130         volumeMounts:
131         - mountPath: /usr/share/filebeat/filebeat.yml
132           subPath: filebeat.yml
133           name: filebeat-conf
134         - mountPath: /var/log/onap
135           name: {{ include "common.fullname" . }}-logs
136         - mountPath: /usr/share/filebeat/data
137           name: aai-sparky-filebeat
138
139       volumes:
140       - name: localtime
141         hostPath:
142           path: /etc/localtime
143       - name: {{ include "common.fullname" . }}-config
144         configMap:
145           name: {{ include "common.fullname" . }}
146       - name: {{ include "common.fullname" . }}-auth-config
147         secret:
148           secretName: {{ include "common.fullname" . }}
149       - name: {{ include "common.fullname" . }}-camel-rests-config
150         configMap:
151           name: {{ include "common.fullname" . }}-camel-rests
152       - name: {{ include "common.fullname" . }}-descriptors-config
153         configMap:
154           name: {{ include "common.fullname" . }}-descriptors
155       - name: {{ include "common.fullname" . }}-filters-config
156         configMap:
157           name: {{ include "common.fullname" . }}-filters
158       - name: {{ include "common.fullname" . }}-portal-config
159         configMap:
160           name: {{ include "common.fullname" . }}-portal
161       - name: {{ include "common.fullname" . }}-portal-boot-inf-config
162         configMap:
163           name: {{ include "common.fullname" . }}-boot-inf
164       - name: {{ include "common.fullname" . }}-schemas-config
165         configMap:
166           name: {{ include "common.fullname" . }}-schemas
167       - name: {{ include "common.fullname" . }}-spring-beans-config
168         configMap:
169           name: {{ include "common.fullname" . }}-spring-beans
170       - name: filebeat-conf
171         configMap:
172           name: aai-filebeat
173       - name: {{ include "common.fullname" . }}-logs
174         emptyDir: {}
175       - name: aai-sparky-filebeat
176         emptyDir: {}
177       - name: {{ include "common.fullname" . }}-log-conf
178         configMap:
179           name: {{ include "common.fullname" . }}-log
180       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
181       imagePullSecrets:
182       - name: "{{ include "common.namespace" . }}-docker-registry-key"