Updated sdc cert.
[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: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ include "common.release" . }}
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         - {{ include "common.release" . }}-sdc-onboarding-be-cassandra-init
57         env:
58         - name: NAMESPACE
59           valueFrom:
60             fieldRef:
61               apiVersion: v1
62               fieldPath: metadata.namespace
63       - name: {{ include "common.name" . }}-update-config
64         image: "{{ .Values.global.envsubstImage }}"
65         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66         command:
67         - sh
68         args:
69         - -c
70         - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config-output/${PFILE}; chmod 0755 /config-output/${PFILE}; done"
71         env:
72         - name: KEYSTORE_PASS
73           valueFrom:
74             secretKeyRef:
75               name: {{ include "common.release" . }}-sdc-cs-secrets
76               key: keystore_password
77         - name: TRUSTSTORE_PASS
78           valueFrom:
79             secretKeyRef:
80               name: {{ include "common.release" . }}-sdc-cs-secrets
81               key: truststore_password
82         volumeMounts:
83         - name: {{ include "common.fullname" . }}-environments
84           mountPath: /config-input/
85         - name: sdc-environments-output
86           mountPath: /config-output/
87       containers:
88         - name: {{ include "common.name" . }}
89           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
90           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
91           ports:
92           - containerPort: {{ .Values.service.internalPort }}
93           - containerPort: {{ .Values.service.internalPort2 }}
94           {{ if eq .Values.liveness.enabled true }}
95           livenessProbe:
96             httpGet:
97               path: /sdc2/rest/healthCheck
98               port: {{ .Values.service.internalPort }}
99               scheme: HTTPS
100             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
101             periodSeconds: {{ .Values.liveness.periodSeconds }}
102             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
103           {{ end }}
104           readinessProbe:
105             exec:
106               command:
107               - "/var/lib/jetty/ready-probe.sh"
108             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
109             periodSeconds: {{ .Values.readiness.periodSeconds }}
110             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
111           resources:
112 {{ include "common.resources" . | indent 12 }}
113           env:
114           - name: ENVNAME
115             value: {{ .Values.global.env.name }}
116           - name: JAVA_OPTIONS
117             value: {{ .Values.config.javaOptions }}
118           - name: cassandra_ssl_enabled
119             value: {{ .Values.config.cassandraSslEnabled | quote }}
120           - name: HOST_IP
121             valueFrom:
122               fieldRef:
123                 fieldPath: status.podIP
124           volumeMounts:
125           - name: sdc-environments-output
126             mountPath: /var/lib/jetty/chef-solo/environments/
127           - name: sdc-cert
128             mountPath: /var/lib/jetty/chef-solo/cookbooks/sdc-catalog-be/files/default/org.onap.sdc.p12
129             subPath: org.onap.sdc.p12
130           - name: sdc-cert
131             mountPath: /var/lib/jetty/chef-solo/cookbooks/sdc-catalog-be/files/default/org.onap.sdc.trust.jks
132             subPath: org.onap.sdc.trust.jks
133           - name: {{ include "common.fullname" . }}-localtime
134             mountPath: /etc/localtime
135             readOnly: true
136           - name: {{ include "common.fullname" . }}-logs
137             mountPath: /var/log/onap
138           - name: {{ include "common.fullname" . }}-logback
139             mountPath: /tmp/logback.xml
140             subPath: logback.xml
141           lifecycle:
142             postStart:
143               exec:
144                 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"]
145         # side car containers
146         - name: {{ include "common.name" . }}-filebeat-onap
147           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
148           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
149           volumeMounts:
150           - name: {{ include "common.fullname" . }}-filebeat-conf
151             mountPath: /usr/share/filebeat/filebeat.yml
152             subPath: filebeat.yml
153           - name: {{ include "common.fullname" . }}-logs
154             mountPath: /var/log/onap
155           - name: {{ include "common.fullname" . }}-data-filebeat
156             mountPath: /usr/share/filebeat/data
157       volumes:
158       - name: {{ include "common.fullname" . }}-localtime
159         hostPath:
160           path: /etc/localtime
161       - name: sdc-cert
162         secret:
163           secretName: sdc-cert
164       - name: {{ include "common.fullname" . }}-filebeat-conf
165         configMap:
166           name: {{ include "common.release" . }}-sdc-filebeat-configmap
167       - name: {{ include "common.fullname" . }}-data-filebeat
168         emptyDir: {}
169       - name: {{ include "common.fullname" . }}-logback
170         configMap:
171           name : {{ include "common.fullname" . }}-logging-configmap
172       - name: {{ include "common.fullname" . }}-environments
173         configMap:
174           name: {{ include "common.release" . }}-sdc-environments-configmap
175           defaultMode: 0755
176       - name: sdc-environments-output
177         emptyDir: { medium: "Memory" }
178       - name: {{ include "common.fullname" . }}-logs
179         emptyDir: {}
180       imagePullSecrets:
181       - name: "{{ include "common.namespace" . }}-docker-registry-key"