[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / pomba / charts / pomba-search-data / 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: {{ include "common.release" . }}
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: {{ include "common.release" . }}
35       name: {{ include "common.name" . }}
36     spec:
37       initContainers:
38       - command:
39         - /app/ready.py
40         args:
41         - --container-name
42         - pomba-elasticsearch
43         env:
44         - name: NAMESPACE
45           valueFrom:
46             fieldRef:
47               apiVersion: v1
48               fieldPath: metadata.namespace
49         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
50         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51         name: {{ include "common.name" . }}-readiness
52       containers:
53       - name: {{ include "common.name" . }}
54         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         env:
57         - name: CONFIG_HOME
58           value: /opt/app/search-data-service/config/
59         - name: KEY_STORE_PASSWORD
60           value: {{ .Values.config.keyStorePassword }}
61         - name: KEY_MANAGER_PASSWORD
62           value: {{ .Values.config.keyManagerPassword }}
63         volumeMounts:
64         - mountPath: /etc/localtime
65           name: localtime
66           readOnly: true
67         - mountPath: /opt/app/search-data-service/config/filter-config.json
68           subPath: filter-config.json
69           name: {{ include "common.fullname" . }}-service-config
70         - mountPath: /opt/app/search-data-service/config/elastic-search.properties
71           subPath: elastic-search.properties
72           name: {{ include "common.fullname" . }}-service-config
73         - mountPath: /opt/app/search-data-service/config/analysis-config.json
74           subPath: analysis-config.json
75           name: {{ include "common.fullname" . }}-service-config
76         - mountPath: /opt/app/search-data-service/config/es-payload-translation.json
77           subPath: es-payload-translation.json
78           name: {{ include "common.fullname" . }}-service-config
79         - mountPath: /opt/app/search-data-service/config/dynamic-custom-template.json
80           subPath: dynamic-custom-template.json
81           name: {{ include "common.fullname" . }}-service-config
82         - mountPath: /opt/app/search-data-service/config/auth/tomcat_keystore
83           subPath: tomcat_keystore
84           name: {{ include "common.fullname" . }}-service-auth-config
85         - mountPath: /opt/app/search-data-service/config/auth/search_policy.json
86           subPath: search_policy.json
87           name: {{ include "common.fullname" . }}-search-policy-config
88         - mountPath: /var/log/onap
89           name: {{ include "common.fullname" . }}-service-logs
90         - mountPath: /opt/app/search-data-service/bundleconfig/etc/logback.xml
91           name: {{ include "common.fullname" . }}-service-log-conf
92           subPath: logback.xml
93         ports:
94         - containerPort: {{ .Values.service.internalPort }}
95         # disable liveness probe when breakpoints set in debugger
96         # so K8s doesn't restart unresponsive container
97         {{- if eq .Values.liveness.enabled true }}
98         livenessProbe:
99           tcpSocket:
100             port: {{ .Values.service.internalPort }}
101           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
102           periodSeconds: {{ .Values.liveness.periodSeconds }}
103         {{ end -}}
104         readinessProbe:
105           tcpSocket:
106             port: {{ .Values.service.internalPort }}
107           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
108           periodSeconds: {{ .Values.readiness.periodSeconds }}
109         resources:
110 {{ include "common.resources" . | indent 10 }}
111       {{- if .Values.nodeSelector }}
112       nodeSelector:
113 {{ toYaml .Values.nodeSelector | indent 8 }}
114       {{- end -}}
115       {{- if .Values.affinity }}
116       affinity:
117 {{ toYaml .Values.affinity | indent 8 }}
118       {{- end }}
119
120       # side car containers
121       - name: filebeat-onap
122         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
123         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
124         volumeMounts:
125         - mountPath: /usr/share/filebeat/filebeat.yml
126           subPath: filebeat.yml
127           name: filebeat-conf
128         - mountPath: /var/log/onap
129           name: {{ include "common.fullname" . }}-service-logs
130         - mountPath: /usr/share/filebeat/data
131           name: {{ include "common.fullname" . }}-service-filebeat
132
133       volumes:
134       - name: localtime
135         hostPath:
136           path: /etc/localtime
137       - name: {{ include "common.fullname" . }}-service-config
138         configMap:
139           name: {{ include "common.fullname" . }}
140       - name: {{ include "common.fullname" . }}-service-auth-config
141         secret:
142           secretName: {{ include "common.fullname" . }}-keystone
143       - name: {{ include "common.fullname" . }}-search-policy-config
144         secret:
145           secretName: {{ include "common.fullname" . }}-policy
146       - name: filebeat-conf
147         configMap:
148           name: {{ include "common.release" . }}-pomba-filebeat-configmap
149       - name: {{ include "common.fullname" . }}-service-logs
150         emptyDir: {}
151       - name: {{ include "common.fullname" . }}-service-filebeat
152         emptyDir: {}
153       - name: {{ include "common.fullname" . }}-service-log-conf
154         configMap:
155          name: {{ include "common.fullname" . }}-service-log
156       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
157       imagePullSecrets:
158       - name: "{{ include "common.namespace" . }}-docker-registry-key"