Merge "Expose multicloud endpoints in https"
[oom.git] / kubernetes / sdnc / templates / statefulset.yaml
1 # Copyright © 2017 Amdocs, 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/v1beta1
16 kind: StatefulSet
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   serviceName: {{ include "common.servicename" . }}-cluster
27   replicas: {{ .Values.replicaCount }}
28   podManagementPolicy: Parallel
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ include "common.release" . }}
34     spec:
35       initContainers:
36       - command:
37         - /root/ready.py
38         args:
39         - --container-name
40         - {{ .Values.config.mariadbGalera.chartName }}
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" . }}-readiness
50       {{ if .Values.global.aafEnabled }}
51       - name: {{ include "common.name" . }}-aaf-readiness
52         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         command:
55         - /root/ready.py
56         args:
57         - --container-name
58         - aaf-locate
59         env:
60         - name: NAMESPACE
61           valueFrom:
62             fieldRef:
63               apiVersion: v1
64               fieldPath: metadata.namespace
65       - name: {{ include "common.name" . }}-aaf
66         image: {{ .Values.global.repository }}/{{ .Values.aaf_init.agentImage }}
67         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
68         volumeMounts:
69           - mountPath: {{ .Values.certpersistence.certPath }}
70             name: {{ include "common.fullname" . }}-certs
71         command:
72         - bash
73         - -c
74         - |
75           /opt/app/aaf_config/bin/agent.sh &&
76           cd /opt/app/osaaf/local &&
77           /opt/app/aaf_config/bin/agent.sh local showpass | grep cadi_keystore_password= | cut -d= -f 2 > /opt/app/osaaf/local/.pass 2>&1
78         env:
79           - name: APP_FQI
80             value: "{{ .Values.aaf_init.fqi }}"
81           - name: aaf_locate_url
82             value: "https://aaf-locate.{{ .Release.Namespace}}:8095"
83           - name: aaf_locator_container
84             value: "oom"
85           - name: aaf_locator_container_ns
86             value: "{{ .Release.Namespace }}"
87           - name: aaf_locator_fqdn
88             value: "{{ .Values.aaf_init.fqdn }}"
89           - name: aaf_locator_app_ns
90             value: "{{ .Values.aaf_init.app_ns }}"
91           - name: DEPLOY_FQI
92             value: "{{ .Values.aaf_init.deploy_fqi }}"
93           - name: DEPLOY_PASSWORD
94             valueFrom:
95               secretKeyRef:
96                 name: {{ template "common.fullname" .}}-aaf
97                 key: aaf-password
98           - name: cadi_longitude
99             value: "{{ .Values.aaf_init.cadi_longitude }}"
100           - name: cadi_latitude
101             value: "{{ .Values.aaf_init.cadi_latitude }}"
102       {{ end }}
103       - name: {{ include "common.name" . }}-chown
104         image: "busybox"
105         command: ["sh", "-c", "chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.persistence.mdsalPath }} ; chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.certpersistence.certPath }}"]
106         volumeMounts:
107           - mountPath: {{ .Values.persistence.mdsalPath }}
108             name: {{ include "common.fullname" . }}-data
109           - mountPath: {{ .Values.certpersistence.certPath }}
110             name: {{ include "common.fullname" . }}-certs
111       containers:
112         - name: {{ include "common.name" . }}
113           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
114           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
115           command: ["/bin/bash"]
116           args: ["-c", "/opt/sdnc/bin/startODL.sh"]
117           ports:
118           - containerPort: {{ .Values.service.internalPort }}
119           - containerPort: {{ .Values.service.internalPort2 }}
120           - containerPort: {{ .Values.service.internalPort3 }}
121           - containerPort: {{ .Values.service.clusterPort }}
122           readinessProbe:
123             tcpSocket:
124               port: {{ .Values.service.internalPort }}
125             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
126             periodSeconds: {{ .Values.readiness.periodSeconds }}
127           env:
128             - name: MYSQL_ROOT_PASSWORD
129               valueFrom:
130                 secretKeyRef:
131                   name: {{ template "common.fullname" . }}
132                   key: db-root-password
133             - name: ODL_ADMIN_PASSWORD
134               valueFrom:
135                 secretKeyRef:
136                   name: {{ template "common.fullname" . }}-odl
137                   key: odl-password
138             - name: SDNC_DB_PASSWORD
139               valueFrom:
140                 secretKeyRef:
141                   name: {{ template "common.fullname" . }}-sdnctl
142                   key: db-sdnctl-password
143             - 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: "{{.Values.config.mariadbGalera.serviceName}}.{{.Release.Namespace}}"
161             - name: JAVA_HOME
162               value: "{{ .Values.config.javaHome}}"
163           volumeMounts:
164           - mountPath: /etc/localtime
165             name: localtime
166             readOnly: true
167           - mountPath: /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg
168             name: sdnc-logging-cfg-config
169             subPath: org.ops4j.pax.logging.cfg
170           - mountPath: {{ .Values.config.binDir }}/startODL.sh
171             name: bin
172             subPath: startODL.sh
173           - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
174             name: bin
175             subPath: installSdncDb.sh
176           - mountPath: {{ .Values.config.configDir }}/aaiclient.properties
177             name: properties
178             subPath: aaiclient.properties
179           - mountPath: {{ .Values.config.configDir }}/dblib.properties
180             name: properties
181             subPath: dblib.properties
182           - mountPath: {{ .Values.config.configDir }}/lcm-dg.properties
183             name: properties
184             subPath: lcm-dg.properties
185           - mountPath: {{ .Values.config.configDir }}/svclogic.properties
186             name: properties
187             subPath: svclogic.properties
188           - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
189             name: properties
190             subPath: svclogic.properties
191           - mountPath: {{ .Values.config.configDir }}/netbox.properties
192             name: properties
193             subPath: netbox.properties
194           - mountPath: {{ .Values.config.configDir }}/blueprints-processor-adaptor.properties
195             name: properties
196             subPath: blueprints-processor-adaptor.properties
197           - mountPath: {{ .Values.persistence.mdsalPath }}
198             name: {{ include "common.fullname" . }}-data
199           - mountPath: /var/log/onap
200             name: logs
201           - mountPath: {{ .Values.certpersistence.certPath }}
202             name: {{ include "common.fullname" . }}-certs
203           - mountPath: {{ .Values.config.odl.salConfigDir }}/{{ .Values.config.odl.salConfigVersion}}/sal-clustering-config-{{ .Values.config.odl.salConfigVersion}}-akkaconf.xml
204             name: properties
205             subPath: akka.conf
206           - mountPath: {{ .Values.config.odl.etcDir }}/org.opendaylight.controller.cluster.datastore.cfg
207             name: properties
208             subPath: org.opendaylight.controller.cluster.datastore.cfg
209           - mountPath: {{ .Values.config.odl.binDir }}/setenv
210             name: properties
211             subPath: setenv
212           resources:
213 {{ include "common.resources" . | indent 12 }}
214         {{- if .Values.nodeSelector }}
215         nodeSelector:
216 {{ toYaml .Values.nodeSelector | indent 10 }}
217         {{- end -}}
218         {{- if .Values.affinity }}
219         affinity:
220 {{ toYaml .Values.affinity | indent 10 }}
221         {{- end }}
222
223         # side car containers
224         - name: filebeat-onap
225           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
226           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
227           volumeMounts:
228           - mountPath: /usr/share/filebeat/filebeat.yml
229             name: filebeat-conf
230             subPath: filebeat.yml
231           - mountPath: /var/log/onap
232             name: logs
233           - mountPath: /usr/share/filebeat/data
234             name: data-filebeat
235       imagePullSecrets:
236       - name: "{{ include "common.namespace" . }}-docker-registry-key"
237       volumes:
238         - name: localtime
239           hostPath:
240             path: /etc/localtime
241         - name: logs
242           emptyDir: {}
243         - name: data-filebeat
244           emptyDir: {}
245         - name: filebeat-conf
246           configMap:
247             name: {{ include "common.fullname" . }}-filebeat-configmap
248         - name: sdnc-logging-cfg-config
249           configMap:
250             name: {{ include "common.fullname" . }}-log-configmap
251         - name: bin
252           configMap:
253             name: {{ include "common.fullname" . }}-bin
254             defaultMode: 0755
255         - name: properties
256           configMap:
257             name: {{ include "common.fullname" . }}-properties
258             defaultMode: 0644
259         - name: {{ include "common.fullname" . }}-certs
260   {{ if .Values.certpersistence.enabled }}
261           persistentVolumeClaim:
262             claimName: {{ include "common.fullname" . }}-certs
263   {{ else }}
264           emptyDir: {}
265   {{ end }}
266   {{ if not .Values.persistence.enabled }}
267         - name: {{ include "common.fullname" . }}-data
268           emptyDir: {}
269   {{ else }}
270   volumeClaimTemplates:
271   - metadata:
272       name: {{ include "common.fullname" . }}-data
273       labels:
274         name: {{ include "common.fullname" . }}
275         chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
276         release: "{{ include "common.release" . }}"
277         heritage: "{{ .Release.Service }}"
278     spec:
279       accessModes:
280       - {{ .Values.persistence.accessMode }}
281       storageClassName: {{ include "common.storageClass" . }}
282       resources:
283         requests:
284           storage: {{ .Values.persistence.size }}
285   {{- end }}