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