Merge "Add chart for redis cluster"
[oom.git] / kubernetes / aai / charts / aai-sparky-be / 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   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   template:
31     metadata:
32       labels:
33         app: {{ include "common.name" . }}
34         release: {{ .Release.Name }}
35       name: {{ include "common.name" . }}
36     spec:
37       initContainers:
38       - name: {{ include "common.name" . }}-inject-models
39         command:
40         - /bin/bash
41         - "-c"
42         - |
43           git clone -b {{ .Values.config.gerritBranch }} --single-branch {{ .Values.config.gerritProject }} /tmp/gerrit
44           cp -rp /tmp/gerrit/data-router/appconfig/model/* /model-dir
45         image: "{{ .Values.global.repository | default .Values.dockerHubRepository }}/{{ .Values.ubuntuInitImage }}"
46         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47         volumeMounts:
48         - name: modeldir
49           mountPath: "/model-dir"
50       containers:
51       - name: {{ include "common.name" . }}
52         image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         env:
55         - name: CONFIG_HOME
56           value: /opt/app/sparky/config/
57         - name: KEY_MANAGER_PASSWORD
58           value: {{ .Values.config.keyManagerPassword }}
59         - name: KEY_STORE_PASSWORD
60           value: {{ .Values.config.keyStorePassword }}
61         volumeMounts:
62         - mountPath: /etc/localtime
63           name: localtime
64           readOnly: true
65         - mountPath: /opt/app/sparky/config/auth/
66           name: {{ include "common.fullname" . }}-auth-config
67         - mountPath: /opt/app/sparky/config/synchronizer.properties
68           subPath: synchronizer.properties
69           name: {{ include "common.fullname" . }}-config
70         - mountPath: /opt/app/sparky/config/suggestive-search.properties
71           subPath: suggestive-search.properties
72           name: {{ include "common.fullname" . }}-config
73         - mountPath: /opt/app/sparky/config/search-service.properties
74           subPath: search-service.properties
75           name: {{ include "common.fullname" . }}-config
76         - mountPath: /opt/app/sparky/config/roles.config
77           subPath: roles.config
78           name: {{ include "common.fullname" . }}-config
79         - mountPath: /opt/app/sparky/config/elasticsearch.properties
80           subPath: elasticsearch.properties
81           name: {{ include "common.fullname" . }}-config
82         - mountPath: /opt/app/sparky/config/aai.properties
83           subPath: aai.properties
84           name: {{ include "common.fullname" . }}-config
85         - mountPath: /opt/app/sparky/config/portal/
86           name: {{ include "common.fullname" . }}-portal-config
87         - mountPath: /var/log/onap
88           name: {{ include "common.fullname" . }}-logs
89         - mountPath: /opt/app/sparky/bundleconfig/etc/logback.xml
90           name: {{ include "common.fullname" . }}-log-conf
91           subPath: logback.xml
92         - name: modeldir
93           mountPath: /opt/app/sparky/config/model
94         ports:
95         - containerPort: {{ .Values.service.internalPort }}
96         # disable liveness probe when breakpoints set in debugger
97         # so K8s doesn't restart unresponsive container
98         {{- if eq .Values.liveness.enabled true }}
99         livenessProbe:
100           tcpSocket:
101             port: {{ .Values.service.internalPort }}
102           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
103           periodSeconds: {{ .Values.liveness.periodSeconds }}
104         {{ end -}}
105         readinessProbe:
106           tcpSocket:
107             port: {{ .Values.service.internalPort }}
108           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
109           periodSeconds: {{ .Values.readiness.periodSeconds }}
110         resources:
111 {{ toYaml .Values.resources | indent 10 }}
112       {{- if .Values.nodeSelector }}
113       nodeSelector:
114 {{ toYaml .Values.nodeSelector | indent 8 }}
115       {{- end -}}
116       {{- if .Values.affinity }}
117       affinity:
118 {{ toYaml .Values.affinity | indent 8 }}
119       {{- end }}
120
121       # side car containers
122       - name: filebeat-onap
123         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
124         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
125         volumeMounts:
126         - mountPath: /usr/share/filebeat/filebeat.yml
127           subPath: filebeat.yml
128           name: filebeat-conf
129         - mountPath: /var/log/onap
130           name: {{ include "common.fullname" . }}-logs
131         - mountPath: /usr/share/filebeat/data
132           name: aai-sparky-filebeat
133
134       volumes:
135       - name: localtime
136         hostPath:
137           path: /etc/localtime
138       - name: {{ include "common.fullname" . }}-config
139         configMap:
140           name: {{ include "common.fullname" . }}
141       - name: {{ include "common.fullname" . }}-portal-config
142         configMap:
143           name: {{ include "common.fullname" . }}-portal
144       - name: {{ include "common.fullname" . }}-auth-config
145         secret:
146           secretName: {{ include "common.fullname" . }}
147       - name: filebeat-conf
148         configMap:
149           name: aai-filebeat
150       - name: {{ include "common.fullname" . }}-logs
151         emptyDir: {}
152       - name: aai-sparky-filebeat
153         emptyDir: {}
154       - name: {{ include "common.fullname" . }}-log-conf
155         configMap:
156          name: {{ include "common.fullname" . }}-log
157       - name: modeldir
158         emptyDir: {}
159       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
160       imagePullSecrets:
161       - name: "{{ include "common.namespace" . }}-docker-registry-key"