063e2d868f506dfdea430b3cc5c4850c1c4e775f
[oom.git] / kubernetes / sdc / charts / sdc-be / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, AT&T, Bell Canada
2 # Modifications Copyright © 2018 ZTE
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 apiVersion: extensions/v1beta1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ .Release.Name }}
33     spec:
34       initContainers:
35       - name: {{ include "common.name" . }}-readiness
36         command:
37         - /root/ready.py
38         args:
39         - --container-name
40         - "sdc-onboarding-be"
41         env:
42         - name: NAMESPACE
43           valueFrom:
44             fieldRef:
45               apiVersion: v1
46               fieldPath: metadata.namespace
47         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
48         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49       - name: {{ include "common.name" . }}-job-completion
50         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
51         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
52         command:
53         - /root/job_complete.py
54         args:
55         - --job-name
56         - {{ .Release.Name }}-sdc-onboarding-be-cassandra-init
57         env:
58         - name: NAMESPACE
59           valueFrom:
60             fieldRef:
61               apiVersion: v1
62               fieldPath: metadata.namespace
63       containers:
64         - name: {{ include "common.name" . }}
65           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
66           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67           ports:
68           - containerPort: {{ .Values.service.internalPort }}
69           - containerPort: {{ .Values.service.internalPort2 }}
70           {{ if eq .Values.liveness.enabled true }}
71           livenessProbe:
72             exec:
73               command:
74               - "/var/lib/ready-probe.sh"
75             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
76             periodSeconds: {{ .Values.liveness.periodSeconds }}
77           {{ end }}
78           readinessProbe:
79             exec:
80               command:
81               - "/var/lib/ready-probe.sh"
82             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
83             periodSeconds: {{ .Values.readiness.periodSeconds }}
84           resources:
85 {{ include "common.resources" . | indent 12 }}
86           env:
87           - name: ENVNAME
88             value: {{ .Values.global.env.name }}
89           - name: JAVA_OPTIONS
90             value: {{ .Values.config.javaOptions }}
91           - name: cassandra_ssl_enabled
92             value: {{ .Values.config.cassandraSslEnabled | quote }}
93           - name: HOST_IP
94             valueFrom:
95               fieldRef:
96                 fieldPath: status.podIP
97           volumeMounts:
98           - name: {{ include "common.fullname" . }}-environments
99             mountPath: /root/chef-solo/environments/
100           - name: {{ include "common.fullname" . }}-localtime
101             mountPath: /etc/localtime
102             readOnly: true
103           - name: {{ include "common.fullname" . }}-logs
104             mountPath: /var/log/onap
105           - name: {{ include "common.fullname" . }}-logback
106             mountPath: /tmp/logback.xml
107             subPath: logback.xml
108           lifecycle:
109             postStart:
110               exec:
111                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/var/lib/jetty/config/catalog-be/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
112         # side car containers
113         - name: {{ include "common.name" . }}-filebeat-onap
114           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
115           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
116           volumeMounts:
117           - name: {{ include "common.fullname" . }}-filebeat-conf
118             mountPath: /usr/share/filebeat/filebeat.yml
119             subPath: filebeat.yml
120           - name: {{ include "common.fullname" . }}-logs
121             mountPath: /var/log/onap
122           - name: {{ include "common.fullname" . }}-data-filebeat
123             mountPath: /usr/share/filebeat/data
124       volumes:
125       - name: {{ include "common.fullname" . }}-localtime
126         hostPath:
127           path: /etc/localtime
128       - name: {{ include "common.fullname" . }}-filebeat-conf
129         configMap:
130           name: {{ .Release.Name }}-sdc-filebeat-configmap
131       - name: {{ include "common.fullname" . }}-data-filebeat
132         emptyDir: {}
133       - name: {{ include "common.fullname" . }}-logback
134         configMap:
135           name : {{ include "common.fullname" . }}-logging-configmap
136       - name: {{ include "common.fullname" . }}-environments
137         configMap:
138           name: {{ .Release.Name }}-sdc-environments-configmap
139           defaultMode: 0755
140       - name:  {{ include "common.fullname" . }}-logs
141         emptyDir: {}
142       imagePullSecrets:
143       - name: "{{ include "common.namespace" . }}-docker-registry-key"