[SDNC] Change path to daexim directory
[oom.git] / kubernetes / sdnc / templates / statefulset.yaml
1 {{/*
2 # Copyright © 2020 Samsung Electronics
3 # Copyright © 2017 Amdocs, Bell Canada
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 */}}
17
18 apiVersion: apps/v1
19 kind: StatefulSet
20 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
21 spec:
22   selector:
23     matchLabels:
24       app: {{ include "common.name" . }}
25   serviceName: {{ include "common.servicename" . }}-cluster
26   replicas: {{ .Values.replicaCount }}
27   selector: {{- include "common.selectors" . | nindent 4 }}
28   podManagementPolicy: Parallel
29   template:
30     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
31     spec:
32       initContainers:
33       - command:
34         - sh
35         args:
36         - -c
37         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
38         env:
39         - name: AAI_CLIENT_NAME
40           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "login") | indent 10 }}
41         - name: AAI_CLIENT_PASSWORD
42           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "password") | indent 10 }}
43         - name: MODELSERVICE_USER
44           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "login") | indent 10 }}
45         - name: MODELSERVICE_PASSWORD
46           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "password") | indent 10 }}
47         - name: RESTCONF_USER
48           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
49         - name: RESTCONF_PASSWORD
50           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
51         - name: ANSIBLE_USER
52           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "login") | indent 10 }}
53         - name: ANSIBLE_PASSWORD
54           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "password") | indent 10 }}
55         - name: SCALEOUT_USER
56           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "login") | indent 10 }}
57         - name: SCALEOUT_PASSWORD
58           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "password") | indent 10 }}
59         - name: NETBOX_APIKEY
60           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "netbox-apikey" "key" "password") | indent 10 }}
61         - name: SDNC_DB_USER
62           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
63         - name: SDNC_DB_PASSWORD
64           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
65         - name: ODL_ADMIN_USERNAME
66           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 10 }}
67         - name: ODL_ADMIN_PASSWORD
68           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 10 }}
69
70         volumeMounts:
71         - mountPath: /config-input
72           name: config-input
73         - mountPath: /config
74           name: properties
75         image: "{{ .Values.global.envsubstImage }}"
76         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
77         name: {{ include "common.name" . }}-update-config
78       {{ if .Values.dgbuilder.enabled -}}
79       - command:
80         - /app/ready.py
81         args:
82         {{ if or .Values.dgbuilder.enabled .Values.config.sdnr.enabled -}}
83         - --container-name
84         - {{ include "common.mariadbService" . }}
85         {{ end -}}
86         {{ if .Values.config.sdnr.enabled -}}
87         - --container-name
88         - {{ include "common.name" . }}-sdnrdb-init-job
89         {{ end -}}
90         env:
91         - name: NAMESPACE
92           valueFrom:
93             fieldRef:
94               apiVersion: v1
95               fieldPath: metadata.namespace
96         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
97         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
98         name: {{ include "common.name" . }}-readiness
99         {{ end -}}
100 {{ include "common.certInitializer.initContainer" . | indent 6 }}
101
102       {{ if .Values.global.cmpv2Enabled }}
103       - name: certs-init
104         image: "{{ .Values.global.repository }}/{{ .Values.global.platform.certServiceClient.image }}"
105         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
106         env:
107           - name: REQUEST_URL
108             value: {{ .Values.global.platform.certServiceClient.envVariables.requestURL }}
109           - name: REQUEST_TIMEOUT
110             value: "30000"
111           - name: OUTPUT_PATH
112             value: {{ .Values.global.platform.certServiceClient.envVariables.cert_path }}
113           - name: CA_NAME
114             value: {{ .Values.global.platform.certServiceClient.envVariables.caName }}
115           - name: COMMON_NAME
116             value: {{ .Values.global.platform.certServiceClient.envVariables.common_name }}
117           - name: ORGANIZATION
118             value: {{ .Values.global.platform.certServiceClient.envVariables.cmpv2Organization }}
119           - name: ORGANIZATION_UNIT
120             value: {{ .Values.global.platform.certServiceClient.envVariables.cmpv2OrganizationalUnit }}
121           - name: LOCATION
122             value: {{ .Values.global.platform.certServiceClient.envVariables.cmpv2Location }}
123           - name: STATE
124             value: {{ .Values.global.platform.certServiceClient.envVariables.cmpv2State }}
125           - name: COUNTRY
126             value: {{ .Values.global.platform.certServiceClient.envVariables.cmpv2Country }}
127           - name: KEYSTORE_PATH
128             value: {{ .Values.global.platform.certServiceClient.envVariables.keystorePath }}
129           - name: KEYSTORE_PASSWORD
130             value: {{ .Values.global.platform.certServiceClient.envVariables.keystorePassword }}
131           - name: TRUSTSTORE_PATH
132             value: {{ .Values.global.platform.certServiceClient.envVariables.truststorePath }}
133           - name: TRUSTSTORE_PASSWORD
134             value: {{ .Values.global.platform.certServiceClient.envVariables.truststorePassword }}
135         terminationMessagePath: /dev/termination-log
136         terminationMessagePolicy: File
137         volumeMounts:
138           - mountPath: {{ .Values.global.platform.certServiceClient.envVariables.cert_path }}
139             name: certs
140           - mountPath: {{ .Values.global.platform.certServiceClient.secret.mountPath }}
141             name: certservice-tls-volume
142       {{ end }}
143
144       - name: {{ include "common.name" . }}-init-files
145         image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
146         command:
147         - sh
148         args:
149         - -c
150         - |
151            mkdir {{ .Values.persistence.mdsalPath }}/journal
152            mkdir {{ .Values.persistence.mdsalPath }}/snapshots
153            chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.persistence.mdsalPath }}
154 {{- if .Values.global.aafEnabled }}
155            chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.certInitializer.credsPath }}
156 {{- end }}
157         volumeMounts:
158 {{ include "common.certInitializer.volumeMount" . | indent 10 }}
159           - mountPath: {{ .Values.persistence.mdsalPath }}
160             name: {{ include "common.fullname" . }}-data
161       containers:
162         - name: {{ include "common.name" . }}
163           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
164           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
165           command: ["/bin/bash"]
166           args: ["-c", "/opt/onap/sdnc/bin/createLinks.sh ; /opt/onap/sdnc/bin/startODL.sh"]
167           ports:
168           - containerPort: {{ .Values.service.internalPort }}
169           - containerPort: {{ .Values.service.internalPort2 }}
170           - containerPort: {{ .Values.service.internalPort3 }}
171           - containerPort: {{ .Values.service.clusterPort }}
172           readinessProbe:
173             tcpSocket:
174               port: {{ .Values.service.internalPort }}
175             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
176             periodSeconds: {{ .Values.readiness.periodSeconds }}
177           env:
178           - name: MYSQL_ROOT_PASSWORD
179             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
180           - name: ODL_ADMIN_USERNAME
181             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 12 }}
182           - name: ODL_ADMIN_PASSWORD
183             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 12 }}
184           - name: SDNC_DB_USER
185             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
186           - name: SDNC_DB_PASSWORD
187             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
188           - name: SDNC_CONFIG_DIR
189             value: "{{ .Values.config.configDir }}"
190           - name: ENABLE_ODL_CLUSTER
191             value: "{{ .Values.config.enableClustering }}"
192           - name: MY_ODL_CLUSTER
193             value: "{{ .Values.config.myODLCluster }}"
194           - name: PEER_ODL_CLUSTER
195             value: "{{ .Values.config.peerODLCluster }}"
196           - name: IS_PRIMARY_CLUSTER
197             value: "{{ .Values.config.isPrimaryCluster }}"
198           - name: GEO_ENABLED
199             value: "{{ .Values.config.geoEnabled}}"
200           - name: SDNC_AAF_ENABLED
201             value: "{{ .Values.global.aafEnabled}}"
202           - name: SDNC_REPLICAS
203             value: "{{ .Values.replicaCount }}"
204           - name: MYSQL_HOST
205             value: {{ include "common.mariadbService" . }}
206           - name: MDSAL_PATH
207             value: {{ .Values.persistence.mdsalPath }}
208           - name: DAEXIM_PATH
209             value: {{ .Values.persistence.daeximPath }}
210           - name: JOURNAL_PATH
211             value: {{ .Values.persistence.journalPath }}
212           - name: SNAPSHOTS_PATH
213             value: {{ .Values.persistence.snapshotsPath }}
214           - name: JAVA_HOME
215             value: "{{ .Values.config.javaHome}}"
216           - name: JAVA_OPTS
217             value: "-Xms{{.Values.config.odl.javaOptions.minMemory}} -Xmx{{.Values.config.odl.javaOptions.maxMemory}}"
218           - name: KARAF_CONSOLE_LOG_LEVEL
219             value: "{{ include "common.log.level" . }}"
220           - name: SDNRWT
221             value: "{{ .Values.config.sdnr.enabled | default "false"}}"
222           {{- if eq .Values.config.sdnr.mode "web" }}
223           - name: SDNRDM
224             value: "true"
225           {{- end }}
226           - name: SDNRONLY
227             value: "{{ .Values.config.sdnr.sdnronly | default "false" }}"
228           - name: SDNRDBURL
229             {{- $prefix := ternary "https" "http" .Values.global.aafEnabled}}
230             value: "{{$prefix}}://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}"
231           {{- if .Values.config.sdnr.sdnrdbTrustAllCerts }}
232           - name: SDNRDBTRUSTALLCERTS
233             value: "true"
234           {{ end }}
235
236           volumeMounts:
237 {{ include "common.certInitializer.volumeMount" . | indent 10 }}
238           - mountPath: /etc/localtime
239             name: localtime
240             readOnly: true
241           - mountPath: /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg
242             name: sdnc-logging-cfg-config
243             subPath: org.ops4j.pax.logging.cfg
244           - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
245             name: bin
246             subPath: installSdncDb.sh
247           - mountPath: {{ .Values.config.binDir }}/createLinks.sh
248             name: bin
249             subPath: createLinks.sh
250           - mountPath: {{ .Values.config.ccsdkConfigDir }}/aaiclient.properties
251             name: properties
252             subPath: aaiclient.properties
253           - mountPath: {{ .Values.config.configDir }}/aaiclient.properties
254             name: properties
255             subPath: aaiclient.properties
256           - mountPath: {{ .Values.config.configDir }}/dblib.properties
257             name: properties
258             subPath: dblib.properties
259           - mountPath: {{ .Values.config.configDir }}/lcm-dg.properties
260             name: properties
261             subPath: lcm-dg.properties
262           - mountPath: {{ .Values.config.configDir }}/svclogic.properties
263             name: properties
264             subPath: svclogic.properties
265           - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
266             name: properties
267             subPath: svclogic.properties
268           - mountPath: {{ .Values.config.configDir }}/netbox.properties
269             name: properties
270             subPath: netbox.properties
271           - mountPath: {{ .Values.config.configDir }}/blueprints-processor-adaptor.properties
272             name: properties
273             subPath: blueprints-processor-adaptor.properties
274           - mountPath: {{ .Values.persistence.mdsalPath }}
275             name: {{ include "common.fullname" . }}-data
276           - mountPath: /var/log/onap
277             name: logs
278           - mountPath: {{ .Values.config.odl.salConfigDir }}/{{ .Values.config.odl.salConfigVersion}}/sal-clustering-config-{{ .Values.config.odl.salConfigVersion}}-akkaconf.xml
279             name: properties
280             subPath: akka.conf
281           - mountPath: {{ .Values.config.odl.etcDir }}/org.opendaylight.controller.cluster.datastore.cfg
282             name: properties
283             subPath: org.opendaylight.controller.cluster.datastore.cfg
284           - mountPath: {{ .Values.config.odl.etcDir }}/org.opendaylight.aaa.filterchain.cfg
285             name: properties
286             subPath: org.opendaylight.aaa.filterchain.cfg
287           - mountPath: {{ .Values.config.odl.binDir }}/setenv
288             name: properties
289             subPath: setenv
290           - mountPath: {{ .Values.config.odl.etcDir }}/mountpoint-registrar.properties
291             name: properties
292             subPath: mountpoint-registrar.properties
293           - mountPath: {{ .Values.config.odl.etcDir }}/mountpoint-state-provider.properties
294             name: properties
295             subPath: mountpoint-state-provider.properties
296 <<<<<<< HEAD   (a66d33 Merge "[MUSIC] Update certificate" into guilin)
297           {{ if .Values.global.cmpv2Enabled }}
298           - mountPath: {{ .Values.global.platform.certServiceClient.envVariables.cert_path }}
299             name: certs
300           {{- end }}
301 =======
302           - mountPath: {{ .Values.config.odl.etcDir }}/org.opendaylight.daexim.cfg
303             name: properties
304             subPath: org.opendaylight.daexim.cfg
305 >>>>>>> CHANGE (a86300 Change path to daexim directory)
306           resources:
307 {{ include "common.resources" . | indent 12 }}
308         {{- if .Values.nodeSelector }}
309         nodeSelector:
310 {{ toYaml .Values.nodeSelector | indent 10 }}
311         {{- end -}}
312         {{- if .Values.affinity }}
313         affinity:
314 {{ toYaml .Values.affinity | indent 10 }}
315         {{- end }}
316
317         # side car containers
318         - name: filebeat-onap
319           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
320           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
321           volumeMounts:
322           - mountPath: /usr/share/filebeat/filebeat.yml
323             name: filebeat-conf
324             subPath: filebeat.yml
325           - mountPath: /var/log/onap
326             name: logs
327           - mountPath: /usr/share/filebeat/data
328             name: data-filebeat
329       imagePullSecrets:
330       - name: "{{ include "common.namespace" . }}-docker-registry-key"
331       volumes:
332         - name: localtime
333           hostPath:
334             path: /etc/localtime
335         - name: logs
336           emptyDir: {}
337         - name: data-filebeat
338           emptyDir: {}
339         - name: filebeat-conf
340           configMap:
341             name: {{ include "common.fullname" . }}-filebeat-configmap
342         - name: sdnc-logging-cfg-config
343           configMap:
344             name: {{ include "common.fullname" . }}-log-configmap
345         - name: bin
346           configMap:
347             name: {{ include "common.fullname" . }}-bin
348             defaultMode: 0755
349         - name: config-input
350           configMap:
351             name: {{ include "common.fullname" . }}-properties
352             defaultMode: 0644
353         - name: properties
354           emptyDir:
355             medium: Memory
356         {{ if .Values.global.cmpv2Enabled }}
357         - name: certs
358           emptyDir:
359             medium: Memory
360         - name: certservice-tls-volume
361           secret:
362             secretName: {{ .Values.global.platform.certServiceClient.secret.name }}
363         {{- end }}
364   {{ if not .Values.persistence.enabled }}
365         - name: {{ include "common.fullname" . }}-data
366           emptyDir: {}
367   {{ else }}
368 {{ include "common.certInitializer.volumes" . | nindent 8 }}
369   volumeClaimTemplates:
370   - metadata:
371       name: {{ include "common.fullname" . }}-data
372       labels:
373         name: {{ include "common.fullname" . }}
374         chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
375         release: "{{ include "common.release" . }}"
376         heritage: "{{ .Release.Service }}"
377     spec:
378       accessModes:
379       - {{ .Values.persistence.accessMode }}
380       storageClassName: {{ include "common.storageClass" . }}
381       resources:
382         requests:
383           storage: {{ .Values.persistence.size }}
384   {{- end }}