blob: b1da64a748c05d7642eac157183cabd37067e3c1 [file] [log] [blame]
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +01001{{/*
Alexander Dehn9b797d62020-04-21 09:53:50 +00002# Copyright © 2020 Samsung Electronics, highstreet technologies GmbH
jmac065e2ce2018-03-29 01:18:02 +00003# 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.
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010016*/}}
jmac065e2ce2018-03-29 01:18:02 +000017
Grzegorz-Lis1318a772020-07-23 15:08:43 +020018apiVersion: apps/v1
jmac065e2ce2018-03-29 01:18:02 +000019kind: StatefulSet
Alexander Dehn9b797d62020-04-21 09:53:50 +000020metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
jmac065e2ce2018-03-29 01:18:02 +000021spec:
Grzegorz-Lis1318a772020-07-23 15:08:43 +020022 selector:
23 matchLabels:
24 app: {{ include "common.name" . }}
BorislavG1ffbd992018-04-24 07:56:27 +000025 serviceName: {{ include "common.servicename" . }}-cluster
jmac065e2ce2018-03-29 01:18:02 +000026 replicas: {{ .Values.replicaCount }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000027 selector: {{- include "common.selectors" . | nindent 4 }}
jmac065e2ce2018-03-29 01:18:02 +000028 podManagementPolicy: Parallel
29 template:
Alexander Dehn9b797d62020-04-21 09:53:50 +000030 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
jmac065e2ce2018-03-29 01:18:02 +000031 spec:
32 initContainers:
33 - command:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010034 - 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
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010040 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010041 - name: AAI_CLIENT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010042 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010043 - name: MODELSERVICE_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010044 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010045 - name: MODELSERVICE_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010046 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010047 - name: RESTCONF_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010048 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010049 - name: RESTCONF_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010050 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010051 - name: ANSIBLE_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010052 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010053 - name: ANSIBLE_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010054 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010055 - name: SCALEOUT_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010056 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010057 - name: SCALEOUT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010058 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010059 - name: NETBOX_APIKEY
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010060 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "netbox-apikey" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010061 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010062 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010063 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010064 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010065 volumeMounts:
66 - mountPath: /config-input
67 name: config-input
68 - mountPath: /config
69 name: properties
70 image: "{{ .Values.global.envsubstImage }}"
71 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72 name: {{ include "common.name" . }}-update-config
Alexander Dehn9b797d62020-04-21 09:53:50 +000073 {{ if .Values.dgbuilder.enabled -}}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010074 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020075 - /app/ready.py
jmac065e2ce2018-03-29 01:18:02 +000076 args:
Alexander Dehn9b797d62020-04-21 09:53:50 +000077 {{ if or .Values.dgbuilder.enabled .Values.config.sdnr.enabled -}}
jmac065e2ce2018-03-29 01:18:02 +000078 - --container-name
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010079 - {{ include "common.mariadbService" . }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000080 {{ end -}}
81 {{ if .Values.config.sdnr.enabled -}}
82 - --container-name
83 - {{ include "common.name" . }}-sdnrdb-init-job
84 {{ end -}}
jmac065e2ce2018-03-29 01:18:02 +000085 env:
86 - name: NAMESPACE
87 valueFrom:
88 fieldRef:
89 apiVersion: v1
90 fieldPath: metadata.namespace
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020091 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
jmac065e2ce2018-03-29 01:18:02 +000092 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureaux25e01d52019-12-09 11:06:39 +010093 name: {{ include "common.name" . }}-readiness
Alexander Dehn9b797d62020-04-21 09:53:50 +000094 {{ end -}}
Krzysztof Opasiak8ab45472020-05-12 12:53:50 +020095{{ include "common.certInitializer.initContainer" . | indent 6 }}
96
Timoney, Dan (dt5972)ba4d2eb2019-05-07 13:32:42 -040097 - name: {{ include "common.name" . }}-chown
Alexander Dehn1373c9c2020-09-02 09:01:15 +000098 image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
Lucjan Bryndza5c63e932020-06-25 08:43:23 +000099 command:
100 - sh
101 args:
102 - -c
103 - chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.persistence.mdsalPath }}
104{{- if .Values.global.aafEnabled }}
105 - chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.certInitializer.credsPath }}
106{{- end }}
Timoney, Dan (dt5972)ba4d2eb2019-05-07 13:32:42 -0400107 volumeMounts:
Krzysztof Opasiak8ab45472020-05-12 12:53:50 +0200108{{ include "common.certInitializer.volumeMount" . | indent 10 }}
Timoney, Dan (dt5972)ba4d2eb2019-05-07 13:32:42 -0400109 - mountPath: {{ .Values.persistence.mdsalPath }}
Sylvain Desbureaux25e01d52019-12-09 11:06:39 +0100110 name: {{ include "common.fullname" . }}-data
jmac065e2ce2018-03-29 01:18:02 +0000111 containers:
112 - name: {{ include "common.name" . }}
BorislavGdf11cd52018-05-06 12:55:20 +0000113 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
jmac065e2ce2018-03-29 01:18:02 +0000114 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Alexander Dehn9b797d62020-04-21 09:53:50 +0000115 {{- if not .Values.config.sdnr.enabled }}
jmac065e2ce2018-03-29 01:18:02 +0000116 command: ["/bin/bash"]
Dan Timoney830b85f2020-05-27 16:00:05 -0400117 args: ["-c", "/opt/onap/sdnc/bin/startODL.sh"]
Alexander Dehn9b797d62020-04-21 09:53:50 +0000118 {{ else }}
119 command: ["/bin/bash"]
120 args: ["-c", "{{ .Values.config.binDir }}/startODL.oom.sh"]
121 {{ end }}
jmac065e2ce2018-03-29 01:18:02 +0000122 ports:
123 - containerPort: {{ .Values.service.internalPort }}
124 - containerPort: {{ .Values.service.internalPort2 }}
125 - containerPort: {{ .Values.service.internalPort3 }}
126 - containerPort: {{ .Values.service.clusterPort }}
127 readinessProbe:
128 tcpSocket:
129 port: {{ .Values.service.internalPort }}
130 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
131 periodSeconds: {{ .Values.readiness.periodSeconds }}
132 env:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100133 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100134 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100135 - name: ODL_ADMIN_USERNAME
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100136 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100137 - name: ODL_ADMIN_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100138 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100139 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100140 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100141 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100142 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100143 - name: SDNC_CONFIG_DIR
144 value: "{{ .Values.config.configDir }}"
145 - name: ENABLE_ODL_CLUSTER
146 value: "{{ .Values.config.enableClustering }}"
147 - name: MY_ODL_CLUSTER
148 value: "{{ .Values.config.myODLCluster }}"
149 - name: PEER_ODL_CLUSTER
150 value: "{{ .Values.config.peerODLCluster }}"
151 - name: IS_PRIMARY_CLUSTER
152 value: "{{ .Values.config.isPrimaryCluster }}"
153 - name: GEO_ENABLED
154 value: "{{ .Values.config.geoEnabled}}"
155 - name: SDNC_AAF_ENABLED
156 value: "{{ .Values.global.aafEnabled}}"
157 - name: SDNC_REPLICAS
158 value: "{{ .Values.replicaCount }}"
159 - name: MYSQL_HOST
160 value: {{ include "common.mariadbService" . }}
161 - name: JAVA_HOME
162 value: "{{ .Values.config.javaHome}}"
Sylvain Desbureauxbcf72512020-07-22 10:45:18 +0200163 - name: KARAF_CONSOLE_LOG_LEVEL
164 value: "{{ include "common.log.level" . }}"
Alexander Dehn9b797d62020-04-21 09:53:50 +0000165 - name: SDNRWT
166 value: "{{ .Values.config.sdnr.enabled | default "false"}}"
167 {{- if eq .Values.config.sdnr.mode "web" }}
168 - name: SDNRDM
169 value: "true"
170 {{- end }}
171 - name: SDNRONLY
172 value: "{{ .Values.config.sdnr.sdnronly | default "false" }}"
173 - name: SDNRDBURL
174 {{- $prefix := ternary "https" "http" .Values.global.aafEnabled}}
175 value: "{{$prefix}}://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}"
176 {{- if .Values.config.sdnr.sdnrdbTrustAllCerts }}
177 - name: SDNRDBTRUSTALLCERTS
178 value: "true"
179 {{ end }}
180
jmac065e2ce2018-03-29 01:18:02 +0000181 volumeMounts:
Krzysztof Opasiak8ab45472020-05-12 12:53:50 +0200182{{ include "common.certInitializer.volumeMount" . | indent 10 }}
jmac065e2ce2018-03-29 01:18:02 +0000183 - mountPath: /etc/localtime
184 name: localtime
185 readOnly: true
186 - mountPath: /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg
187 name: sdnc-logging-cfg-config
188 subPath: org.ops4j.pax.logging.cfg
jmaca68f4cb2018-05-10 22:44:19 +0000189 - mountPath: {{ .Values.config.binDir }}/startODL.sh
190 name: bin
jmac065e2ce2018-03-29 01:18:02 +0000191 subPath: startODL.sh
Alexander Dehn5c1105e2020-09-14 20:55:56 +0000192 - mountPath: {{ .Values.config.binDir }}/startODL.oom.sh
193 name: bin
194 subPath: startODL.oom.sh
jmaca68f4cb2018-05-10 22:44:19 +0000195 - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
196 name: bin
jmac065e2ce2018-03-29 01:18:02 +0000197 subPath: installSdncDb.sh
Konrad Bańka5ea1db32020-04-06 14:32:46 +0200198 - mountPath: {{ .Values.config.ccsdkConfigDir }}/aaiclient.properties
199 name: properties
200 subPath: aaiclient.properties
jmaca68f4cb2018-05-10 22:44:19 +0000201 - mountPath: {{ .Values.config.configDir }}/aaiclient.properties
202 name: properties
jmac065e2ce2018-03-29 01:18:02 +0000203 subPath: aaiclient.properties
jmaca68f4cb2018-05-10 22:44:19 +0000204 - mountPath: {{ .Values.config.configDir }}/dblib.properties
205 name: properties
jmac065e2ce2018-03-29 01:18:02 +0000206 subPath: dblib.properties
jmac7c434672018-05-11 20:14:17 +0000207 - mountPath: {{ .Values.config.configDir }}/lcm-dg.properties
208 name: properties
209 subPath: lcm-dg.properties
jmaca68f4cb2018-05-10 22:44:19 +0000210 - mountPath: {{ .Values.config.configDir }}/svclogic.properties
211 name: properties
jmac065e2ce2018-03-29 01:18:02 +0000212 subPath: svclogic.properties
213 - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
jmaca68f4cb2018-05-10 22:44:19 +0000214 name: properties
jmac065e2ce2018-03-29 01:18:02 +0000215 subPath: svclogic.properties
Alexis de Talhouët43c67e02018-09-20 16:49:16 -0400216 - mountPath: {{ .Values.config.configDir }}/netbox.properties
217 name: properties
218 subPath: netbox.properties
219 - mountPath: {{ .Values.config.configDir }}/blueprints-processor-adaptor.properties
220 name: properties
221 subPath: blueprints-processor-adaptor.properties
jmac8d6dc962018-04-26 14:26:55 +0000222 - mountPath: {{ .Values.persistence.mdsalPath }}
Sylvain Desbureaux25e01d52019-12-09 11:06:39 +0100223 name: {{ include "common.fullname" . }}-data
jmac065e2ce2018-03-29 01:18:02 +0000224 - mountPath: /var/log/onap
225 name: logs
Timoney, Dan (dt5972)58774772019-08-21 16:50:54 -0400226 - mountPath: {{ .Values.config.odl.salConfigDir }}/{{ .Values.config.odl.salConfigVersion}}/sal-clustering-config-{{ .Values.config.odl.salConfigVersion}}-akkaconf.xml
227 name: properties
228 subPath: akka.conf
229 - mountPath: {{ .Values.config.odl.etcDir }}/org.opendaylight.controller.cluster.datastore.cfg
230 name: properties
231 subPath: org.opendaylight.controller.cluster.datastore.cfg
232 - mountPath: {{ .Values.config.odl.binDir }}/setenv
233 name: properties
234 subPath: setenv
Alexander Dehn9b797d62020-04-21 09:53:50 +0000235 - mountPath: {{ .Values.config.odl.etcDir }}/mountpoint-registrar.properties
236 name: properties
237 subPath: mountpoint-registrar.properties
238 - mountPath: {{ .Values.config.odl.etcDir }}/mountpoint-state-provider.properties
239 name: properties
240 subPath: mountpoint-state-provider.properties
jmac065e2ce2018-03-29 01:18:02 +0000241 resources:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +0000242{{ include "common.resources" . | indent 12 }}
jmac065e2ce2018-03-29 01:18:02 +0000243 {{- if .Values.nodeSelector }}
244 nodeSelector:
245{{ toYaml .Values.nodeSelector | indent 10 }}
246 {{- end -}}
247 {{- if .Values.affinity }}
248 affinity:
249{{ toYaml .Values.affinity | indent 10 }}
250 {{- end }}
251
252 # side car containers
253 - name: filebeat-onap
254 image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
255 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
256 volumeMounts:
257 - mountPath: /usr/share/filebeat/filebeat.yml
258 name: filebeat-conf
259 subPath: filebeat.yml
260 - mountPath: /var/log/onap
261 name: logs
262 - mountPath: /usr/share/filebeat/data
263 name: data-filebeat
jmac8d6dc962018-04-26 14:26:55 +0000264 imagePullSecrets:
265 - name: "{{ include "common.namespace" . }}-docker-registry-key"
jmac065e2ce2018-03-29 01:18:02 +0000266 volumes:
267 - name: localtime
268 hostPath:
269 path: /etc/localtime
270 - name: logs
271 emptyDir: {}
272 - name: data-filebeat
273 emptyDir: {}
274 - name: filebeat-conf
275 configMap:
276 name: {{ include "common.fullname" . }}-filebeat-configmap
277 - name: sdnc-logging-cfg-config
278 configMap:
279 name: {{ include "common.fullname" . }}-log-configmap
jmaca68f4cb2018-05-10 22:44:19 +0000280 - name: bin
jmac065e2ce2018-03-29 01:18:02 +0000281 configMap:
jmaca68f4cb2018-05-10 22:44:19 +0000282 name: {{ include "common.fullname" . }}-bin
283 defaultMode: 0755
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100284 - name: config-input
jmac065e2ce2018-03-29 01:18:02 +0000285 configMap:
jmaca68f4cb2018-05-10 22:44:19 +0000286 name: {{ include "common.fullname" . }}-properties
287 defaultMode: 0644
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100288 - name: properties
289 emptyDir:
290 medium: Memory
jmac8d6dc962018-04-26 14:26:55 +0000291 {{ if not .Values.persistence.enabled }}
Sylvain Desbureaux25e01d52019-12-09 11:06:39 +0100292 - name: {{ include "common.fullname" . }}-data
jmac8d6dc962018-04-26 14:26:55 +0000293 emptyDir: {}
294 {{ else }}
Krzysztof Opasiak8ab45472020-05-12 12:53:50 +0200295{{ include "common.certInitializer.volumes" . | nindent 8 }}
jmac8d6dc962018-04-26 14:26:55 +0000296 volumeClaimTemplates:
297 - metadata:
Sylvain Desbureaux25e01d52019-12-09 11:06:39 +0100298 name: {{ include "common.fullname" . }}-data
jmac8d6dc962018-04-26 14:26:55 +0000299 labels:
300 name: {{ include "common.fullname" . }}
Sylvain Desbureaux25e01d52019-12-09 11:06:39 +0100301 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100302 release: "{{ include "common.release" . }}"
Sylvain Desbureaux25e01d52019-12-09 11:06:39 +0100303 heritage: "{{ .Release.Service }}"
jmac8d6dc962018-04-26 14:26:55 +0000304 spec:
Sylvain Desbureaux25e01d52019-12-09 11:06:39 +0100305 accessModes:
306 - {{ .Values.persistence.accessMode }}
307 storageClassName: {{ include "common.storageClass" . }}
jmac8d6dc962018-04-26 14:26:55 +0000308 resources:
309 requests:
310 storage: {{ .Values.persistence.size }}
Sylvain Desbureaux25e01d52019-12-09 11:06:39 +0100311 {{- end }}