update log helm chart from 2 to 3.0.0
[oom.git] / kubernetes / sdc / charts / sdc-fe / 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   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       initContainers:
34       - name: {{ include "common.name" . }}-readiness
35         command:
36         - /root/ready.py
37         args:
38         - --container-name
39         - "sdc-kb"
40         env:
41         - name: NAMESPACE
42           valueFrom:
43             fieldRef:
44               apiVersion: v1
45               fieldPath: metadata.namespace
46         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
47         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
48       - name: {{ include "common.name" . }}-job-completion
49         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
50         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
51         command:
52         - /root/job_complete.py
53         args:
54         - --job-name
55         - {{ .Release.Name }}-sdc-be-config-backend
56         env:
57         - name: NAMESPACE
58           valueFrom:
59             fieldRef:
60               apiVersion: v1
61               fieldPath: metadata.namespace
62       containers:
63         - name: {{ include "common.name" . }}
64           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
65           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66           ports:
67           - containerPort: {{ .Values.service.internalPort }}
68           - containerPort: {{ .Values.service.internalPort2 }}
69           {{ if eq .Values.liveness.enabled true }}
70           livenessProbe:
71             tcpSocket:
72               port: {{ .Values.service.internalPort }}
73             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
74             periodSeconds: {{ .Values.liveness.periodSeconds }}
75           {{ end }}
76           readinessProbe:
77             tcpSocket:
78               port: {{ .Values.service.internalPort }}
79             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
80             periodSeconds: {{ .Values.readiness.periodSeconds }}
81           env:
82           - name: ENVNAME
83             value: {{ .Values.global.env.name }}
84           - name: HOST_IP
85             valueFrom:
86               fieldRef:
87                 fieldPath: status.podIP
88           - name: JAVA_OPTIONS
89             value: {{ .Values.config.javaOptions }}
90           volumeMounts:
91           - name: {{ include "common.fullname" . }}-environments
92             mountPath: /root/chef-solo/environments/
93           - name: {{ include "common.fullname" . }}-localtime
94             mountPath: /etc/localtime
95             readOnly: true
96           - name: {{ include "common.fullname" . }}-logs
97             mountPath: /var/log/onap
98           - name: {{ include "common.fullname" . }}-logback
99             mountPath: /tmp/logback.xml
100             subPath: logback.xml
101           lifecycle:
102             postStart:
103               exec:
104                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/var/lib/jetty/config/catalog-fe/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
105           resources:
106 {{ toYaml .Values.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: {{ include "common.name" . }}-filebeat-onap
118           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
119           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
120           volumeMounts:
121           - name: {{ include "common.fullname" . }}-filebeat-conf
122             mountPath: /usr/share/filebeat/filebeat.yml
123             subPath: filebeat.yml
124           - name: {{ include "common.fullname" . }}-logs
125             mountPath: /var/log/onap
126           - name: {{ include "common.fullname" . }}-data-filebeat
127             mountPath: /usr/share/filebeat/data
128       volumes:
129         - name: {{ include "common.fullname" . }}-localtime
130           hostPath:
131             path: /etc/localtime
132         - name: {{ include "common.fullname" . }}-filebeat-conf
133           configMap:
134             name: {{ .Release.Name }}-sdc-filebeat-configmap
135         - name: {{ include "common.fullname" . }}-data-filebeat
136           emptyDir: {}
137         - name: {{ include "common.fullname" . }}-logback
138           configMap:
139             name : {{ include "common.fullname" . }}-logging-configmap
140         - name: {{ include "common.fullname" . }}-environments
141           configMap:
142             name: {{ .Release.Name }}-sdc-environments-configmap
143             defaultMode: 0755
144         - name:  {{ include "common.fullname" . }}-logs
145           emptyDir: {}
146       imagePullSecrets:
147       - name: "{{ include "common.namespace" . }}-docker-registry-key"