Updating charts to use common resource template
[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/schemaIngest.properties
96             subPath: schemaIngest.properties
97             name: {{ include "common.fullname" . }}-config
98           - mountPath: /opt/app/spike/config/model/edge_props
99             name: {{ include "common.fullname" . }}-edge-props-config
100           - mountPath: /opt/app/spike/bundleconfig/etc/logback.xml
101             name: {{ include "common.fullname" . }}-config
102             subPath: logback.xml
103           - mountPath: /var/log/onap
104             name: {{ include "common.fullname" . }}-logs
105           resources:
106 {{ include "common.resources" . | indent 12 }}
107         {{- if .Values.nodeSelector }}
108         nodeSelector:
109 {{ toYaml .Values.nodeSelector | indent 10 }}
110         {{- end -}}
111         {{- if .Values.affinity }}
112         affinity:
113 {{ toYaml .Values.affinity | indent 10 }}
114         {{- end }}
115
116         # side car containers
117         - name: filebeat-onap
118           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
119           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
120           volumeMounts:
121           - mountPath: /usr/share/filebeat/filebeat.yml
122             subPath: filebeat.yml
123             name: filebeat-conf
124           - mountPath: /var/log/onap
125             name: {{ include "common.fullname" . }}-logs
126           - mountPath: /usr/share/filebeat/data
127             name: aai-filebeat
128
129       volumes:
130         - name: localtime
131           hostPath:
132             path: /etc/localtime
133         - name: {{ include "common.fullname" . }}-secrets
134           secret:
135             secretName: {{ include "common.fullname" . }}-spike-secrets
136         - name: {{ include "common.fullname" . }}-config
137           configMap:
138             name: {{ include "common.fullname" . }}-configmap
139             items:
140             - key: spike.properties
141               path: spike.properties
142             - key: spike-beans.xml
143               path: spike-beans.xml
144             - key: schemaIngest.properties
145               path: schemaIngest.properties
146             - key: logback.xml
147               path: logback.xml
148         - name: {{ include "common.fullname" . }}-edge-props-config
149           configMap:
150             name: {{ include "common.fullname" . }}-edge-props-configmap
151         - name: filebeat-conf
152           configMap:
153             name: aai-filebeat
154         - name: {{ include "common.fullname" . }}-logs
155           emptyDir: {}
156         - name: aai-filebeat
157           emptyDir: {}
158       imagePullSecrets:
159       - name: "{{ include "common.namespace" . }}-docker-registry-key"