Merge "Upgrade APPC to use common mariadb galera charts"
[oom.git] / kubernetes / appc / templates / statefulset.yaml
1 # Copyright © 2018  AT&T, Amdocs, Bell Canada Intellectual Property.  All rights reserved.
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: "{{ .Values.service.name }}-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       imagePullSecrets:
36       - name: "{{ include "common.namespace" . }}-docker-registry-key"
37       initContainers:
38       - command:
39         - /root/ready.py
40         args:
41         - --container-name
42         - {{.Values.config.mariadbGaleraContName}}
43         env:
44         - name: NAMESPACE
45           valueFrom:
46             fieldRef:
47               apiVersion: v1
48               fieldPath: metadata.namespace
49         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
50         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51         name: {{ include "common.name" . }}-readiness
52       containers:
53         - name: {{ include "common.name" . }}
54           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
55           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56           command:
57           - /opt/appc/bin/startODL.sh
58           ports:
59           - containerPort: {{ .Values.service.internalPort }}
60           - containerPort: {{ .Values.service.externalPort2 }}
61           readinessProbe:
62             exec:
63               command:
64               - /opt/appc/bin/health_check.sh
65             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
66             periodSeconds: {{ .Values.readiness.periodSeconds }}
67           env:
68             - name: MYSQL_ROOT_PASSWORD
69               valueFrom:
70                 secretKeyRef:
71                   name: {{ template "common.fullname" . }}
72                   key: db-root-password
73             - name: SDNC_CONFIG_DIR
74               value: "{{ .Values.config.configDir }}"
75             - name: APPC_CONFIG_DIR
76               value: "{{ .Values.config.configDir }}"
77             - name: DMAAP_TOPIC_ENV
78               value: "{{ .Values.config.dmaapTopic }}"
79             - name: ENABLE_AAF
80               value: "{{ .Values.config.enableAAF }}"
81             - name: ENABLE_ODL_CLUSTER
82               value: "{{ .Values.config.enableClustering }}"
83             - name: APPC_REPLICAS
84               value: "{{ .Values.replicaCount }}"
85           volumeMounts:
86           - mountPath: /etc/localtime
87             name: localtime
88             readOnly: true
89           - mountPath: /opt/onap/appc/data/properties/dblib.properties
90             name: onap-appc-data-properties
91             subPath: dblib.properties
92           - mountPath: /opt/onap/appc/data/properties/svclogic.properties
93             name: onap-appc-data-properties
94             subPath: svclogic.properties
95           - mountPath: /opt/onap/appc/data/properties/appc.properties
96             name: onap-appc-data-properties
97             subPath: appc.properties
98           - mountPath: /opt/onap/appc/data/properties/aaiclient.properties
99             name: onap-appc-data-properties
100             subPath: aaiclient.properties
101           - mountPath: /opt/onap/appc/data/properties/aaa-app-config.xml
102             name: onap-appc-data-properties
103             subPath: aaa-app-config.xml
104           - mountPath: /opt/onap/appc/svclogic/config/svclogic.properties
105             name: onap-appc-svclogic-config
106             subPath: svclogic.properties
107           - mountPath: /opt/onap/appc/svclogic/bin/showActiveGraphs.sh
108             name: onap-appc-svclogic-bin
109             subPath: showActiveGraphs.sh
110           - mountPath: /opt/onap/appc/bin/startODL.sh
111             name: onap-appc-bin
112             subPath: startODL.sh
113           - mountPath: /opt/onap/appc/bin/installAppcDb.sh
114             name: onap-appc-bin
115             subPath: installAppcDb.sh
116           - mountPath: /opt/onap/appc/bin/health_check.sh
117             name: onap-appc-bin
118             subPath: health_check.sh
119           - mountPath: /opt/onap/ccsdk/data/properties/dblib.properties
120             name: onap-sdnc-data-properties
121             subPath: dblib.properties
122           - mountPath: /opt/onap/ccsdk/data/properties/svclogic.properties
123             name: onap-sdnc-data-properties
124             subPath: svclogic.properties
125           - mountPath: /opt/onap/ccsdk/data/properties/aaiclient.properties
126             name: onap-sdnc-data-properties
127             subPath: aaiclient.properties
128           - mountPath: /opt/onap/ccsdk/svclogic/config/svclogic.properties
129             name: onap-sdnc-svclogic-config
130             subPath: svclogic.properties
131           - mountPath: /opt/onap/ccsdk/svclogic/bin/showActiveGraphs.sh
132             name: onap-sdnc-svclogic-bin
133             subPath: showActiveGraphs.sh
134           - mountPath: /opt/onap/ccsdk/bin/startODL.sh
135             name: onap-sdnc-bin
136             subPath: startODL.sh
137           - mountPath: /opt/onap/ccsdk/bin/installSdncDb.sh
138             name: onap-sdnc-bin
139             subPath: installSdncDb.sh
140           - mountPath: {{ .Values.persistence.mdsalPath }}
141             name: {{ include "common.fullname" . }}-data
142           - mountPath: /var/log/onap
143             name: logs
144           - mountPath: /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg
145             name: log-config
146             subPath: org.ops4j.pax.logging.cfg
147           resources:
148 {{ toYaml .Values.resources | indent 12 }}
149         {{- if .Values.nodeSelector }}
150         nodeSelector:
151 {{ toYaml .Values.nodeSelector | indent 10 }}
152         {{- end -}}
153         {{- if .Values.affinity }}
154         affinity:
155 {{ toYaml .Values.affinity | indent 10 }}
156         {{- end }}
157
158         # side car containers
159         - name: filebeat-onap
160           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
161           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
162           volumeMounts:
163           - mountPath: /usr/share/filebeat/filebeat.yml
164             name: filebeat-conf
165             subPath: filebeat.yml
166           - mountPath: /var/log/onap
167             name: logs
168           - mountPath: /usr/share/filebeat/data
169             name: data-filebeat
170       volumes:
171         - name: localtime
172           hostPath:
173             path: /etc/localtime
174         - name: filebeat-conf
175           configMap:
176             name: {{ include "common.fullname" . }}-filebeat
177         - name: log-config
178           configMap:
179             name: {{ include "common.fullname" . }}-logging-cfg
180         - name: logs
181           emptyDir: {}
182         - name: data-filebeat
183           emptyDir: {}
184         - name: onap-appc-data-properties
185           configMap:
186             name: {{ include "common.fullname" . }}-onap-appc-data-properties
187         - name: onap-appc-svclogic-config
188           configMap:
189             name: {{ include "common.fullname" . }}-onap-appc-svclogic-config
190         - name: onap-appc-svclogic-bin
191           configMap:
192             name: {{ include "common.fullname" . }}-onap-appc-svclogic-bin
193             defaultMode: 0755
194         - name: onap-appc-bin
195           configMap:
196             name: {{ include "common.fullname" . }}-onap-appc-bin
197             defaultMode: 0755
198         - name: onap-sdnc-data-properties
199           configMap:
200             name: {{ include "common.fullname" . }}-onap-sdnc-data-properties
201         - name: onap-sdnc-svclogic-config
202           configMap:
203             name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-config
204         - name: onap-sdnc-svclogic-bin
205           configMap:
206             name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-bin
207             defaultMode: 0755
208         - name: onap-sdnc-bin
209           configMap:
210             name: {{ include "common.fullname" . }}-onap-sdnc-bin
211             defaultMode: 0755
212 {{ if not .Values.persistence.enabled }}
213         - name: {{ include "common.fullname" . }}-data
214           emptyDir: {}
215 {{ else }}
216   volumeClaimTemplates:
217   - metadata:
218       name: {{ include "common.fullname" . }}-data
219       labels:
220         name: {{ include "common.fullname" . }}
221     spec:
222       accessModes: [ {{ .Values.persistence.accessMode }} ]
223       storageClassName: {{ include "common.fullname" . }}-data
224       resources:
225         requests:
226           storage: {{ .Values.persistence.size }}
227 {{ end }}