[DCAE] Update Bootstrap image and component images. Update Cm-container
[oom.git] / kubernetes / sdc / components / sdc-dcae-be / templates / deployment.yaml
1 # Copyright © 2018 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: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
37       - name: {{ include "common.name" . }}-readiness
38         command:
39         - /app/ready.py
40         args:
41         - --container-name
42         - "sdc-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       - name: {{ include "common.name" . }}-job-completion
52         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
53         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
54         command:
55         - /app/ready.py
56         args:
57         - --job-name
58         - {{ include "common.release" . }}-sdc-be-config-backend
59         env:
60         - name: NAMESPACE
61           valueFrom:
62             fieldRef:
63               apiVersion: v1
64               fieldPath: metadata.namespace
65       {{- if .Values.global.aafEnabled }}
66       - name: {{ include "common.name" . }}-update-config
67         image: "{{ .Values.global.envsubstImage }}"
68         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69         command:
70         - sh
71         args:
72         - "-c"
73         - |
74           export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
75           export KEYSTORE_PASS=$cadi_keystore_password_p12
76           export KEYMANAGER_PASS=$cadi_keystore_password_p12
77           export TRUSTSTORE_PASS=$cadi_truststore_password
78           cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }} /config-output
79           cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }} /config-output
80           cd /config-input && \
81           for PFILE in `find . -not -type d | grep -v -F ..`
82           do
83             envsubst <${PFILE} >/config-output/${PFILE}
84             chmod 0755 /config-output/${PFILE}
85           done
86         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
87           - name: {{ include "common.fullname" . }}-environments
88             mountPath: /config-input/
89           - name: sdc-environments-output
90             mountPath: /config-output/
91       {{- end }}
92       containers:
93         - name: {{ include "common.name" . }}
94           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
95           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
96           {{- if .Values.global.aafEnabled }}
97           command:
98           - sh
99           args:
100           - "-c"
101           - |
102             sed -i '/trustStorePassword/d' ${JETTY_BASE}/startup.sh
103             ${JETTY_BASE}/startup.sh
104           {{- end }}
105           ports:
106           - containerPort: {{ .Values.service.internalPort }}
107           - containerPort: {{ .Values.service.internalPort2 }}
108           {{ if eq .Values.liveness.enabled true }}
109           livenessProbe:
110             tcpSocket:
111               port: {{ .Values.service.internalPort2 }}
112             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
113             periodSeconds: {{ .Values.liveness.periodSeconds }}
114           {{ end }}
115           readinessProbe:
116             httpGet:
117               path: /dcae/conf/composition
118               port: {{ .Values.service.internalPort2 }}
119               scheme: HTTPS
120             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
121             periodSeconds: {{ .Values.readiness.periodSeconds }}
122           env:
123           - name: ENVNAME
124             value: {{ .Values.env.name }}
125           - name: JAVA_OPTIONS
126             value: {{ .Values.config.javaOptions }}
127           - name: HOST_IP
128             valueFrom:
129               fieldRef:
130                 fieldPath: status.podIP
131           volumeMounts:
132           - name: sdc-environments-output
133             mountPath: /var/lib/jetty/chef-solo/environments/
134           - name: sdc-environments-output
135             mountPath: /var/lib/jetty/chef-solo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.p12
136             subPath: org.onap.sdc.p12
137           - name: sdc-environments-output
138             mountPath: /var/lib/jetty/chef-solo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks
139             subPath: org.onap.sdc.trust.jks
140           - name: {{ include "common.fullname" . }}-localtime
141             mountPath: /etc/localtime
142             readOnly: true
143           - name: {{ include "common.fullname" . }}-logs
144             mountPath: /var/lib/jetty/logs
145           - name: {{ include "common.fullname" . }}-logback
146             mountPath: /tmp/logback.xml
147             subPath: logback.xml
148           lifecycle:
149             postStart:
150               exec:
151                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/var/lib/jetty/config/dcae-be/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
152           resources:
153 {{ include "common.resources" . | indent 12 }}
154         {{- if .Values.nodeSelector }}
155         nodeSelector:
156 {{ toYaml .Values.nodeSelector | indent 10 }}
157         {{- end -}}
158         {{- if .Values.affinity }}
159         affinity:
160 {{ toYaml .Values.affinity | indent 10 }}
161         {{- end }}
162
163         # side car containers
164         - name: {{ include "common.name" . }}-filebeat-onap
165           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
166           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
167           volumeMounts:
168           - name: {{ include "common.fullname" . }}-filebeat-conf
169             mountPath: /usr/share/filebeat/filebeat.yml
170             subPath: filebeat.yml
171           - name: {{ include "common.fullname" . }}-logs
172             mountPath: /var/log/onap
173           - name: {{ include "common.fullname" . }}-data-filebeat
174             mountPath: /usr/share/filebeat/data
175       volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
176       - name: {{ include "common.fullname" . }}-localtime
177         hostPath:
178           path: /etc/localtime
179       - name: {{ include "common.fullname" . }}-filebeat-conf
180         configMap:
181           name: {{ include "common.release" . }}-sdc-filebeat-configmap
182       - name: {{ include "common.fullname" . }}-data-filebeat
183         emptyDir: {}
184       - name: {{ include "common.fullname" . }}-logback
185         configMap:
186           name : {{ include "common.fullname" . }}-logging-configmap
187       - name: {{ include "common.fullname" . }}-environments
188         configMap:
189           name: {{ include "common.release" . }}-sdc-environments-configmap
190           defaultMode: 0755
191       - name: sdc-environments-output
192         emptyDir: { medium: "Memory" }
193       - name: {{ include "common.fullname" . }}-logs
194         emptyDir: {}
195       imagePullSecrets:
196       - name: "{{ include "common.namespace" . }}-docker-registry-key"