blob: e2329d7ca54c56907642940c727f7749730a883d [file] [log] [blame]
Mandeep Khindab1f9efe2018-03-28 19:01:55 +00001# Copyright © 2017 Amdocs, AT&T, Bell Canada
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +00002# Modifications Copyright © 2018 ZTE
Mandeep Khindab1f9efe2018-03-28 19:01:55 +00003#
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
gummara72e6de2020-03-12 11:15:56 +000016apiVersion: apps/v1
Mandeep Khindaa1047f42018-03-22 02:12:15 +000017kind: Deployment
gummara72e6de2020-03-12 11:15:56 +000018metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000019spec:
gummara72e6de2020-03-12 11:15:56 +000020 selector: {{- include "common.selectors" . | nindent 4 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000021 replicas: {{ .Values.replicaCount }}
22 template:
gummara72e6de2020-03-12 11:15:56 +000023 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000024 spec:
ChrisC742a7b22020-09-04 11:29:57 +020025 initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000026 - name: {{ include "common.name" . }}-readiness
27 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020028 - /app/ready.py
Mandeep Khindaa1047f42018-03-22 02:12:15 +000029 args:
30 - --container-name
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000031 - "sdc-onboarding-be"
Mandeep Khindaa1047f42018-03-22 02:12:15 +000032 env:
33 - name: NAMESPACE
34 valueFrom:
35 fieldRef:
36 apiVersion: v1
37 fieldPath: metadata.namespace
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020038 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
Mandeep Khindaa1047f42018-03-22 02:12:15 +000039 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40 - name: {{ include "common.name" . }}-job-completion
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020041 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
Mandeep Khindaa1047f42018-03-22 02:12:15 +000042 imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
43 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020044 - /app/ready.py
Mandeep Khindaa1047f42018-03-22 02:12:15 +000045 args:
46 - --job-name
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010047 - {{ include "common.release" . }}-sdc-onboarding-be-cassandra-init
Mandeep Khindaa1047f42018-03-22 02:12:15 +000048 env:
49 - name: NAMESPACE
50 valueFrom:
51 fieldRef:
52 apiVersion: v1
53 fieldPath: metadata.namespace
ChrisC742a7b22020-09-04 11:29:57 +020054 {{- if .Values.global.aafEnabled }}
k.kedron2774ab12020-03-26 11:13:46 +010055 - name: {{ include "common.name" . }}-update-config
56 image: "{{ .Values.global.envsubstImage }}"
57 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58 command:
59 - sh
60 args:
ChrisC742a7b22020-09-04 11:29:57 +020061 - "-c"
62 - |
63 export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
64 export KEYSTORE_PASS=$cadi_keystore_password_p12
65 export KEYMANAGER_PASS=$cadi_keystore_password_p12
66 export TRUSTSTORE_PASS=$cadi_truststore_password
67 cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }} /config-output
68 cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }} /config-output
69 cd /config-input && \
70 for PFILE in `find . -not -type d | grep -v -F ..`
71 do
72 envsubst <${PFILE} >/config-output/${PFILE}
73 chmod 0755 /config-output/${PFILE}
74 done
75 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
k.kedron2774ab12020-03-26 11:13:46 +010076 - name: {{ include "common.fullname" . }}-environments
77 mountPath: /config-input/
78 - name: sdc-environments-output
79 mountPath: /config-output/
ChrisC742a7b22020-09-04 11:29:57 +020080 {{- end }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000081 containers:
82 - name: {{ include "common.name" . }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000083 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
Mandeep Khindaa1047f42018-03-22 02:12:15 +000084 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
ChrisC742a7b22020-09-04 11:29:57 +020085 {{- if .Values.global.aafEnabled }}
86 command:
87 - sh
88 args:
89 - "-c"
90 - |
91 sed -i '/trustStorePassword/d' ${JETTY_BASE}/startup.sh
92 ${JETTY_BASE}/startup.sh
93 {{- end }}
gummara72e6de2020-03-12 11:15:56 +000094 ports: {{ include "common.containerPorts" . | nindent 10 }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000095 {{ if eq .Values.liveness.enabled true }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000096 livenessProbe:
Yang Xue5d5e682019-06-19 18:20:31 -040097 httpGet:
shrek2000f336f6d2020-02-25 16:11:26 +020098 path: /sdc2/rest/healthCheck
gummara72e6de2020-03-12 11:15:56 +000099 port: {{ .Values.liveness.port }}
100 scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000101 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
102 periodSeconds: {{ .Values.liveness.periodSeconds }}
Yang Xu85608542019-06-16 23:25:32 -0400103 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000104 {{ end }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000105 readinessProbe:
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000106 exec:
107 command:
MichaelMorrisb137f7e2020-03-15 17:44:48 +0000108 - "/var/lib/jetty/ready-probe.sh"
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000109 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
110 periodSeconds: {{ .Values.readiness.periodSeconds }}
Yang Xu85608542019-06-16 23:25:32 -0400111 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
gummara72e6de2020-03-12 11:15:56 +0000112 resources: {{ include "common.resources" . | nindent 12 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000113 env:
114 - name: ENVNAME
ChrisC742a7b22020-09-04 11:29:57 +0200115 value: {{ .Values.env.name }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000116 - name: JAVA_OPTIONS
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000117 value: {{ .Values.config.javaOptions }}
118 - name: cassandra_ssl_enabled
119 value: {{ .Values.config.cassandraSslEnabled | quote }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000120 - name: HOST_IP
121 valueFrom:
122 fieldRef:
123 fieldPath: status.podIP
124 volumeMounts:
k.kedron2774ab12020-03-26 11:13:46 +0100125 - name: sdc-environments-output
MichaelMorrisb137f7e2020-03-15 17:44:48 +0000126 mountPath: /var/lib/jetty/chef-solo/environments/
ChrisC742a7b22020-09-04 11:29:57 +0200127 - name: sdc-environments-output
k.kedron2774ab12020-03-26 11:13:46 +0100128 mountPath: /var/lib/jetty/chef-solo/cookbooks/sdc-catalog-be/files/default/org.onap.sdc.p12
129 subPath: org.onap.sdc.p12
ChrisC742a7b22020-09-04 11:29:57 +0200130 - name: sdc-environments-output
k.kedron2774ab12020-03-26 11:13:46 +0100131 mountPath: /var/lib/jetty/chef-solo/cookbooks/sdc-catalog-be/files/default/org.onap.sdc.trust.jks
132 subPath: org.onap.sdc.trust.jks
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000133 - 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
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000140 subPath: logback.xml
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000141 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"]
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000145 # 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
ChrisC742a7b22020-09-04 11:29:57 +0200157 volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000158 - name: {{ include "common.fullname" . }}-localtime
159 hostPath:
160 path: /etc/localtime
161 - name: {{ include "common.fullname" . }}-filebeat-conf
162 configMap:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100163 name: {{ include "common.release" . }}-sdc-filebeat-configmap
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000164 - name: {{ include "common.fullname" . }}-data-filebeat
165 emptyDir: {}
166 - name: {{ include "common.fullname" . }}-logback
167 configMap:
168 name : {{ include "common.fullname" . }}-logging-configmap
169 - name: {{ include "common.fullname" . }}-environments
170 configMap:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100171 name: {{ include "common.release" . }}-sdc-environments-configmap
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000172 defaultMode: 0755
k.kedron2774ab12020-03-26 11:13:46 +0100173 - name: sdc-environments-output
174 emptyDir: { medium: "Memory" }
175 - name: {{ include "common.fullname" . }}-logs
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000176 emptyDir: {}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000177 imagePullSecrets:
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +0000178 - name: "{{ include "common.namespace" . }}-docker-registry-key"