Merge "Update to v13 A&AI APIs and correct service name"
[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: {{ .Release.Name }}
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: {{ .Release.Name }}
34     spec:
35       initContainers:
36       - command:
37         - /root/ready.py
38         args:
39         - --container-name
40         - {{ .Values.mysql.nameOverride }}
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       containers:
51         - name: {{ include "common.name" . }}
52           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
53           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54           command: ["/bin/bash"]
55           args: ["-c", "/opt/sdnc/bin/startODL.sh"]
56           ports:
57           - containerPort: {{ .Values.service.internalPort }}
58           - containerPort: {{ .Values.service.internalPort2 }}
59           - containerPort: {{ .Values.service.internalPort3 }}
60           - containerPort: {{ .Values.service.clusterPort }}
61           readinessProbe:
62             tcpSocket:
63               port: {{ .Values.service.internalPort }}
64             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
65             periodSeconds: {{ .Values.readiness.periodSeconds }}
66           env:
67             - name: MYSQL_ROOT_PASSWORD
68               valueFrom:
69                 secretKeyRef:
70                   name: {{ template "common.fullname" . }}
71                   key: db-root-password
72             - name: SDNC_CONFIG_DIR
73               value: "{{ .Values.config.configDir }}"
74             - name: ENABLE_ODL_CLUSTER
75               value: "{{ .Values.config.enableClustering }}"
76             - name: SDNC_REPLICAS
77               value: "{{ .Values.replicaCount }}"
78             - name: MYSQL_HOST
79               value: "{{.Values.mysql.service.name}}.{{.Release.Namespace}}"
80           volumeMounts:
81           - mountPath: /etc/localtime
82             name: localtime
83             readOnly: true
84           - mountPath: /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg
85             name: sdnc-logging-cfg-config
86             subPath: org.ops4j.pax.logging.cfg
87           - mountPath: /opt/onap/sdnc/bin/startODL.sh
88             name: startodl
89             subPath: startODL.sh
90           - mountPath: /opt/onap/sdnc/bin/installSdncDb.sh
91             name: installsdncdb
92             subPath: installSdncDb.sh
93           - mountPath: /opt/onap/sdnc/data/properties/aaiclient.properties
94             name: aaiclient-conf
95             subPath: aaiclient.properties
96           - mountPath: /opt/onap/sdnc/data/properties/dblib.properties
97             name: sdnc-dblib-properties
98             subPath: dblib.properties
99           - mountPath: /opt/onap/sdnc/data/properties/svclogic.properties
100             name: sdnc-svclogic-config
101             subPath: svclogic.properties
102           - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
103             name: onap-sdnc-svclogic-config
104             subPath: svclogic.properties
105           - mountPath: {{ .Values.persistence.mdsalPath }}
106             name: {{ include "common.fullname" . }}-data
107           - mountPath: /var/log/onap
108             name: logs
109           resources:
110 {{ toYaml .Values.resources | indent 12 }}
111         {{- if .Values.nodeSelector }}
112         nodeSelector:
113 {{ toYaml .Values.nodeSelector | indent 10 }}
114         {{- end -}}
115         {{- if .Values.affinity }}
116         affinity:
117 {{ toYaml .Values.affinity | indent 10 }}
118         {{- end }}
119
120         # side car containers
121         - name: filebeat-onap
122           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
123           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
124           volumeMounts:
125           - mountPath: /usr/share/filebeat/filebeat.yml
126             name: filebeat-conf
127             subPath: filebeat.yml
128           - mountPath: /var/log/onap
129             name: logs
130           - mountPath: /usr/share/filebeat/data
131             name: data-filebeat
132       imagePullSecrets:
133       - name: "{{ include "common.namespace" . }}-docker-registry-key"
134       volumes:
135         - name: localtime
136           hostPath:
137             path: /etc/localtime
138         - name: logs
139           emptyDir: {}
140         - name: data-filebeat
141           emptyDir: {}
142         - name: filebeat-conf
143           configMap:
144             name: {{ include "common.fullname" . }}-filebeat-configmap
145         - name: sdnc-logging-cfg-config
146           configMap:
147             name: {{ include "common.fullname" . }}-log-configmap
148         - name: startodl
149           configMap:
150             name: {{ include "common.fullname" . }}-startodl
151             items:
152             - key: startODL.sh
153               path: startODL.sh
154               mode: 0755
155         - name: installsdncdb
156           configMap:
157             name: {{ include "common.fullname" . }}-installsdncdb
158             items:
159             - key: installSdncDb.sh
160               path: installSdncDb.sh
161               mode: 0755
162         - name: aaiclient-conf
163           configMap:
164             name: {{ include "common.fullname" . }}-aaiclient-properties
165             items:
166             - key: aaiclient.properties
167               path: aaiclient.properties
168               mode: 0644
169         - name: sdnc-dblib-properties
170           configMap:
171             name: {{ include "common.fullname" . }}-dblib-properties
172             items:
173             - key: dblib.properties
174               path: dblib.properties
175               mode: 0644
176         - name: sdnc-svclogic-config
177           configMap:
178             name: {{ include "common.fullname" . }}-svclogic-config
179             items:
180             - key: svclogic.properties
181               path: svclogic.properties
182               mode: 0644
183         - name: onap-sdnc-svclogic-config
184           configMap:
185             name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-config
186             items:
187             - key: svclogic.properties
188               path: svclogic.properties
189               mode: 0644
190   {{ if not .Values.persistence.enabled }}
191         - name: {{ include "common.fullname" . }}-data
192           emptyDir: {}
193   {{ else }}
194   volumeClaimTemplates:
195   - metadata:
196       name: {{ include "common.fullname" . }}-data
197       labels:
198         name: {{ include "common.fullname" . }}
199     spec:
200       accessModes: [ {{ .Values.persistence.accessMode }} ]
201       storageClassName: {{ include "common.fullname" . }}-data
202       resources:
203         requests:
204           storage: {{ .Values.persistence.size }}
205   {{ end }}