c962f1df2b0417a4242f3a60aab21c91831c96d8
[oom.git] / kubernetes / aai / charts / aai-spike / templates / deployment.yaml
1 # Copyright © 2018 Amdocs, AT&T
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         - message-router-kafka
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           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           ports:
53           - containerPort: {{ .Values.service.internalPort }}
54           # disable liveness probe when breakpoints set in debugger
55           # so K8s doesn't restart unresponsive container
56           {{ if .Values.liveness.enabled }}
57           livenessProbe:
58             tcpSocket:
59               port: {{ .Values.service.internalPort }}
60             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
61             periodSeconds: {{ .Values.liveness.periodSeconds }}
62           {{ end }}
63           readinessProbe:
64             tcpSocket:
65               port: {{ .Values.service.internalPort }}
66             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
67             periodSeconds: {{ .Values.readiness.periodSeconds }}
68           env:
69             - name: CONFIG_HOME
70               value: /opt/app/spike/config
71             - name: KEY_STORE_PASSWORD
72               valueFrom:
73                 secretKeyRef:
74                   name: {{ template "common.fullname" . }}-pass
75                   key: KEY_STORE_PASSWORD
76             - name: KEY_MANAGER_PASSWORD
77               valueFrom:
78                 secretKeyRef:
79                   name: {{ template "common.fullname" . }}-pass
80                   key: KEY_MANAGER_PASSWORD
81             - name: SERVICE_BEANS
82               value: /opt/app/spike/dynamic/conf
83           volumeMounts:
84           - mountPath: /etc/localtime
85             name: localtime
86             readOnly: true
87           - mountPath: /opt/app/spike/config/auth
88             name: {{ include "common.fullname" . }}-secrets
89           - mountPath: /opt/app/spike/dynamic/conf/spike-beans.xml
90             name: {{ include "common.fullname" . }}-config
91             subPath: spike-beans.xml
92           - mountPath: /opt/app/spike/config/spike.properties
93             subPath: spike.properties
94             name: {{ include "common.fullname" . }}-config
95           - mountPath: /opt/app/spike/config/schema-ingest.properties
96             subPath: schema-ingest.properties
97             name: {{ include "common.fullname" . }}-config
98           - mountPath: /opt/app/spike/config/edgeprops-ingest.properties
99             subPath: edgeprops-ingest.properties
100             name: {{ include "common.fullname" . }}-config
101           - mountPath: /opt/app/spike/config/model/edge_props
102             name: {{ include "common.fullname" . }}-edge-props-config
103           - mountPath: /opt/app/spike/bundleconfig/etc/logback.xml
104             name: {{ include "common.fullname" . }}-config
105             subPath: logback.xml
106           - mountPath: /var/log/onap
107             name: {{ include "common.fullname" . }}-logs
108           resources:
109 {{ include "common.resources" . }}
110       {{- if .Values.nodeSelector }}
111       nodeSelector:
112 {{ toYaml .Values.nodeSelector | indent 8 }}
113       {{- end -}}
114       {{- if .Values.affinity }}
115       affinity:
116 {{ toYaml .Values.affinity | indent 8 }}
117       {{- end }}
118
119         # side car containers
120         - name: filebeat-onap
121           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
122           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
123           volumeMounts:
124           - mountPath: /usr/share/filebeat/filebeat.yml
125             subPath: filebeat.yml
126             name: filebeat-conf
127           - mountPath: /var/log/onap
128             name: {{ include "common.fullname" . }}-logs
129           - mountPath: /usr/share/filebeat/data
130             name: aai-filebeat
131           resources:
132 {{ include "common.resources" . }}
133
134       volumes:
135         - name: localtime
136           hostPath:
137             path: /etc/localtime
138         - name: {{ include "common.fullname" . }}-secrets
139           secret:
140             secretName: {{ include "common.fullname" . }}-spike-secrets
141         - name: {{ include "common.fullname" . }}-config
142           configMap:
143             name: {{ include "common.fullname" . }}-configmap
144             items:
145             - key: spike.properties
146               path: spike.properties
147             - key: spike-beans.xml
148               path: spike-beans.xml
149             - key: schema-ingest.properties
150               path: schema-ingest.properties
151             - key: edgeprops-ingest.properties
152               path: edgeprops-ingest.properties
153             - key: logback.xml
154               path: logback.xml
155         - name: {{ include "common.fullname" . }}-edge-props-config
156           configMap:
157             name: {{ include "common.fullname" . }}-edge-props-configmap
158         - name: filebeat-conf
159           configMap:
160             name: aai-filebeat
161         - name: {{ include "common.fullname" . }}-logs
162           emptyDir: {}
163         - name: aai-filebeat
164           emptyDir: {}
165       imagePullSecrets:
166       - name: "{{ include "common.namespace" . }}-docker-registry-key"