1eaae73175f860dc4574f44fd5df9d1c05e3e130
[oom.git] / kubernetes / appc / templates / statefulset.yaml
1 apiVersion: apps/v1beta1
2 kind: StatefulSet
3 metadata:
4   name: {{ include "common.fullname" . }}
5   namespace: {{ include "common.namespace" . }}
6   labels:
7     app: {{ include "common.name" . }}
8     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
9     release: {{ .Release.Name }}
10     heritage: {{ .Release.Service }}
11 spec:
12   serviceName: "{{ .Values.service.name }}-cluster"
13   replicas: {{ .Values.replicaCount }}
14   podManagementPolicy: Parallel
15   template:
16     metadata:
17       labels:
18         app: {{ include "common.name" . }}
19         release: {{ .Release.Name }}
20     spec:
21       initContainers:
22       - command:
23         - /root/ready.py
24         args:
25         - --container-name
26         - {{ .Values.mysql.nameOverride }}
27         env:
28         - name: NAMESPACE
29           valueFrom:
30             fieldRef:
31               apiVersion: v1
32               fieldPath: metadata.namespace
33         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
34         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
35         name: {{ include "common.name" . }}-readiness
36       containers:
37         - name: {{ include "common.name" . }}
38           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
39           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40           command:
41           - /opt/appc/bin/startODL.sh
42           ports:
43           - containerPort: {{ .Values.service.internalPort }}
44           - containerPort: {{ .Values.service.externalPort2 }}
45           readinessProbe:
46             tcpSocket:
47               port: {{ .Values.service.internalPort }}
48             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
49             periodSeconds: {{ .Values.readiness.periodSeconds }}
50           env:
51             - name: MYSQL_ROOT_PASSWORD
52               valueFrom:
53                 secretKeyRef:
54                   name: {{ template "common.fullname" . }}
55                   key: db-root-password
56             - name: SDNC_CONFIG_DIR
57               value: "{{ .Values.config.configDir }}"
58             - name: APPC_CONFIG_DIR
59               value: "{{ .Values.config.configDir }}"
60             - name: DMAAP_TOPIC_ENV
61               value: "{{ .Values.config.dmaapTopic }}"
62             - name: ENABLE_ODL_CLUSTER
63               value: "{{ .Values.config.enableClustering }}"
64             - name: APPC_REPLICAS
65               value: "{{ .Values.replicaCount }}"
66           volumeMounts:
67           - mountPath: /etc/localtime
68             name: localtime
69             readOnly: true
70           - mountPath: /opt/onap/appc/data/properties/dblib.properties
71             name: onap-appc-data-properties
72             subPath: dblib.properties
73           - mountPath: /opt/onap/appc/data/properties/svclogic.properties
74             name: onap-appc-data-properties
75             subPath: svclogic.properties
76           - mountPath: /opt/onap/appc/data/properties/appc.properties
77             name: onap-appc-data-properties
78             subPath: appc.properties
79           - mountPath: /opt/onap/appc/data/properties/aaiclient.properties
80             name: onap-appc-data-properties
81             subPath: aaiclient.properties
82           - mountPath: /opt/onap/appc/svclogic/config/svclogic.properties
83             name: onap-appc-svclogic-config
84             subPath: svclogic.properties
85           - mountPath: /opt/onap/appc/svclogic/bin/showActiveGraphs.sh
86             name: onap-appc-svclogic-bin
87             subPath: showActiveGraphs.sh
88           - mountPath: /opt/onap/appc/bin/startODL.sh
89             name: onap-appc-bin
90             subPath: startODL.sh
91           - mountPath: /opt/onap/appc/bin/installAppcDb.sh
92             name: onap-appc-bin
93             subPath: installAppcDb.sh
94           - mountPath: /opt/onap/ccsdk/data/properties/dblib.properties
95             name: onap-sdnc-data-properties
96             subPath: dblib.properties
97           - mountPath: /opt/onap/ccsdk/data/properties/svclogic.properties
98             name: onap-sdnc-data-properties
99             subPath: svclogic.properties
100           - mountPath: /opt/onap/ccsdk/data/properties/aaiclient.properties
101             name: onap-sdnc-data-properties
102             subPath: aaiclient.properties
103           - mountPath: /opt/onap/ccsdk/svclogic/config/svclogic.properties
104             name: onap-sdnc-svclogic-config
105             subPath: svclogic.properties
106           - mountPath: /opt/onap/ccsdk/svclogic/bin/showActiveGraphs.sh
107             name: onap-sdnc-svclogic-bin
108             subPath: showActiveGraphs.sh
109           - mountPath: /opt/onap/ccsdk/bin/startODL.sh
110             name: onap-sdnc-bin
111             subPath: startODL.sh
112           - mountPath: /opt/onap/ccsdk/bin/installSdncDb.sh
113             name: onap-sdnc-bin
114             subPath: installSdncDb.sh
115           - mountPath: {{ .Values.persistence.mdsalPath }}
116             name: {{ include "common.fullname" . }}-data
117           - mountPath: /var/log/onap
118             name: logs
119           - mountPath: /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg
120             name: log-config
121             subPath: org.ops4j.pax.logging.cfg
122           resources:
123 {{ toYaml .Values.resources | indent 12 }}
124         {{- if .Values.nodeSelector }}
125         nodeSelector:
126 {{ toYaml .Values.nodeSelector | indent 10 }}
127         {{- end -}}
128         {{- if .Values.affinity }}
129         affinity:
130 {{ toYaml .Values.affinity | indent 10 }}
131         {{- end }}
132
133         # side car containers
134         - name: filebeat-onap
135           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
136           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
137           volumeMounts:
138           - mountPath: /usr/share/filebeat/filebeat.yml
139             name: filebeat-conf
140             subPath: filebeat.yml
141           - mountPath: /var/log/onap
142             name: logs
143           - mountPath: /usr/share/filebeat/data
144             name: data-filebeat
145       volumes:
146         - name: localtime
147           hostPath:
148             path: /etc/localtime
149         - name: filebeat-conf
150           configMap:
151             name: {{ include "common.fullname" . }}-filebeat
152         - name: log-config
153           configMap:
154             name: {{ include "common.fullname" . }}-logging-cfg
155         - name: logs
156           emptyDir: {}
157         - name: data-filebeat
158           emptyDir: {}
159         - name: onap-appc-data-properties
160           configMap:
161             name: {{ include "common.fullname" . }}-onap-appc-data-properties
162         - name: onap-appc-svclogic-config
163           configMap:
164             name: {{ include "common.fullname" . }}-onap-appc-svclogic-config
165         - name: onap-appc-svclogic-bin
166           configMap:
167             name: {{ include "common.fullname" . }}-onap-appc-svclogic-bin
168             defaultMode: 0755
169         - name: onap-appc-bin
170           configMap:
171             name: {{ include "common.fullname" . }}-onap-appc-bin
172             defaultMode: 0755
173         - name: onap-sdnc-data-properties
174           configMap:
175             name: {{ include "common.fullname" . }}-onap-sdnc-data-properties
176         - name: onap-sdnc-svclogic-config
177           configMap:
178             name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-config
179         - name: onap-sdnc-svclogic-bin
180           configMap:
181             name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-bin
182             defaultMode: 0755
183         - name: onap-sdnc-bin
184           configMap:
185             name: {{ include "common.fullname" . }}-onap-sdnc-bin
186             defaultMode: 0755
187 #{{ if not .Values.persistence.enabled }}
188         - name: {{ include "common.fullname" . }}-data
189           emptyDir: {}
190 #{{ else }}
191   volumeClaimTemplates:
192   - metadata:
193       name: {{ include "common.fullname" . }}-data
194       labels:
195         name: {{ include "common.fullname" . }}
196     spec:
197       accessModes: [ {{ .Values.persistence.accessMode }} ]
198       storageClassName: {{ include "common.fullname" . }}-data
199       resources:
200         requests:
201           storage: {{ .Values.persistence.size }}
202 #{{ end }}
203       imagePullSecrets:
204       - name: "{{ include "common.namespace" . }}-docker-registry-key"