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