[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / sdc / charts / sdc-dcae-tosca-lab / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, AT&T, 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: apps/v1
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   selector:
27     matchLabels:
28       app: {{ include "common.name" . }}
29   replicas: {{ .Values.replicaCount }}
30   template:
31     metadata:
32       labels:
33         app: {{ include "common.name" . }}
34         release: {{ include "common.release" . }}
35     spec:
36       initContainers:
37       - name: {{ include "common.name" . }}-readiness
38         command:
39         - /app/ready.py
40         args:
41         - --container-name
42         - "sdc-dcae-be"
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
52       containers:
53         - name: {{ include "common.name" . }}
54           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
55           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56           ports:
57           - containerPort: {{ .Values.service.internalPort }}
58           - containerPort: {{ .Values.service.internalPort2 }}
59           {{ if eq .Values.liveness.enabled true }}
60           livenessProbe:
61             tcpSocket:
62               port: {{ .Values.service.internalPort2 }}
63             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
64             periodSeconds: {{ .Values.liveness.periodSeconds }}
65           {{ end }}
66           readinessProbe:
67             httpGet:
68               path: /healthcheck
69               port: {{ .Values.service.internalPort }}
70             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
71             periodSeconds: {{ .Values.readiness.periodSeconds }}
72           env:
73           - name: ENVNAME
74             value: {{ .Values.global.env.name }}
75           - name: JAVA_OPTIONS
76             value: {{ .Values.config.javaOptions }}
77           - name: HOST_IP
78             valueFrom:
79               fieldRef:
80                 fieldPath: status.podIP
81           volumeMounts:
82           - name: {{ include "common.fullname" . }}-environments
83             mountPath: /var/lib/jetty/chef-solo/environments/
84           - name: {{ include "common.fullname" . }}-localtime
85             mountPath: /etc/localtime
86             readOnly: true
87           - name: {{ include "common.fullname" . }}-logs
88             mountPath: /var/log/onap
89           resources:
90 {{ include "common.resources" . | indent 12 }}
91         {{- if .Values.nodeSelector }}
92         nodeSelector:
93 {{ toYaml .Values.nodeSelector | indent 10 }}
94         {{- end -}}
95         {{- if .Values.affinity }}
96         affinity:
97 {{ toYaml .Values.affinity | indent 10 }}
98         {{- end }}
99         # side car containers
100         - name: {{ include "common.name" . }}-filebeat-onap
101           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
102           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
103           volumeMounts:
104           - name: {{ include "common.fullname" . }}-filebeat-conf
105             mountPath: /usr/share/filebeat/filebeat.yml
106             subPath: filebeat.yml
107           - name: {{ include "common.fullname" . }}-logs
108             mountPath: /var/log/onap
109           - name: {{ include "common.fullname" . }}-data-filebeat
110             mountPath: /usr/share/filebeat/data
111       volumes:
112       - name: {{ include "common.fullname" . }}-localtime
113         hostPath:
114           path: /etc/localtime
115       - name: {{ include "common.fullname" . }}-filebeat-conf
116         configMap:
117           name: {{ include "common.release" . }}-sdc-filebeat-configmap
118       - name: {{ include "common.fullname" . }}-data-filebeat
119         emptyDir: {}
120       - name: {{ include "common.fullname" . }}-environments
121         configMap:
122           name: {{ include "common.release" . }}-sdc-environments-configmap
123           defaultMode: 0755
124       - name:  {{ include "common.fullname" . }}-logs
125         emptyDir: {}
126       imagePullSecrets:
127       - name: "{{ include "common.namespace" . }}-docker-registry-key"