Migrate oom docs
[oom.git] / kubernetes / dmaap / components / dmaap-dr-node / 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 apiVersion: apps/v1beta1
15 kind: StatefulSet
16 metadata:
17   name: {{ include "common.fullname" . }}
18   namespace: {{ include "common.namespace" . }}
19   labels:
20     app: {{ include "common.name" . }}
21     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
22     release: {{ include "common.release" . }}
23     heritage: {{ .Release.Service }}
24 spec:
25   replicas: {{ .Values.replicaCount }}
26   serviceName: {{ .Values.config.dmaapDrNode.name }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ include "common.release" . }}
32     spec:
33       initContainers:
34         - name: {{ include "common.name" . }}-readiness
35           image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
36           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
37           command:
38           - /root/ready.py
39           args:
40           - --container-name
41           - dmaap-dr-prov
42           env:
43           - name: NAMESPACE
44             valueFrom:
45               fieldRef:
46                 apiVersion: v1
47                 fieldPath: metadata.namespace
48         {{- if .Values.global.aafEnabled }}
49         - name: {{ include "common.name" . }}-aaf-readiness
50           image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           command:
53           - /root/ready.py
54           args:
55           - --container-name
56           - aaf-locate
57           env:
58           - name: NAMESPACE
59             valueFrom:
60               fieldRef:
61                 apiVersion: v1
62                 fieldPath: metadata.namespace
63         - name: {{ include "common.name" . }}-dr-node-aaf-config
64           image: "{{ include "common.repository" . }}/{{ .Values.global.aafAgentImage }}"
65           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66           volumeMounts:
67           - mountPath: {{ .Values.persistence.aafCredsPath }}
68             name: {{ include "common.fullname" . }}-aaf-props
69           command: ["bash","-c","exec /opt/app/aaf_config/bin/agent.sh"]
70           env:
71           - name: APP_FQI
72             value: "{{ .Values.aafConfig.fqi }}"
73           - name: aaf_locate_url
74             value: "https://aaf-locate.{{ .Release.Namespace }}:8095"
75           - name: aaf_locator_container
76             value: "{{ .Values.global.aafLocatorContainer }}"
77           - name: aaf_locator_container_ns
78             value: "{{ .Release.Namespace }}"
79           - name: aaf_locator_fqdn
80             value: "{{ .Values.aafConfig.fqdn }}"
81           - name: aaf_locator_public_fqdn
82             value: "{{.Values.aafConfig.publicFqdn}}"
83           - name: aaf_locator_app_ns
84             value: "{{ .Values.global.aafAppNs }}"
85           - name: DEPLOY_FQI
86             value: "{{ .Values.aafConfig.aafDeployFqi }}"
87           - name: DEPLOY_PASSWORD
88             value: "{{ .Values.aafConfig.aafDeployPass }}"
89           - name: cadi_longitude
90             value: "{{ .Values.aafConfig.cadiLongitude }}"
91           - name: cadi_latitude
92             value: "{{ .Values.aafConfig.cadiLatitude }}"
93         {{- end }}
94         - name: {{ include "common.name" . }}-permission-fixer
95           image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
96           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
97           volumeMounts:
98           - mountPath: {{ .Values.persistence.spoolPath }}
99             name: {{ include "common.fullname" . }}-data
100           - mountPath: {{ .Values.persistence.eventLogsPath }}
101             name: {{ include "common.fullname" . }}-event-logs
102         {{- if .Values.global.aafEnabled }}
103           - mountPath: {{ .Values.persistence.aafCredsPath }}
104             name: {{ include "common.fullname" . }}-aaf-props
105         {{- end }}
106           command: ["chown","-Rf","1000:1001", "/opt/app/"]
107       containers:
108         - name: {{ include "common.name" . }}
109           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
110           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
111           ports:
112           - containerPort: {{.Values.config.dmaapDrNode.externalPort}}
113           - containerPort: {{.Values.config.dmaapDrNode.externalPort2}}
114           {{- if eq .Values.liveness.enabled true }}
115           livenessProbe:
116             tcpSocket:
117               port: {{.Values.config.dmaapDrNode.internalPort}}
118             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
119             periodSeconds: {{ .Values.liveness.periodSeconds }}
120           {{ end -}}
121           readinessProbe:
122             tcpSocket:
123               port: {{.Values.config.dmaapDrNode.internalPort}}
124             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
125             periodSeconds: {{ .Values.readiness.periodSeconds }}
126           volumeMounts:
127           {{- if .Values.global.aafEnabled }}
128           - mountPath: {{ .Values.persistence.aafCredsPath }}
129             name: {{ include "common.fullname" . }}-aaf-props
130           {{- end }}
131           - mountPath: {{ .Values.persistence.spoolPath }}
132             name: {{ include "common.fullname" . }}-data
133           - mountPath: {{ .Values.persistence.eventLogsPath }}
134             name: {{ include "common.fullname" . }}-event-logs
135           - mountPath: /etc/localtime
136             name: localtime
137             readOnly: false
138           - mountPath: /opt/app/datartr/etc/node.properties
139             name: {{ include "common.fullname" . }}-config
140             subPath: node.properties
141           - mountPath: /opt/app/datartr/etc/logback.xml
142             name: {{ include "common.fullname" . }}-log-conf
143             subPath: logback.xml
144           - mountPath: {{ .Values.global.loggingDirectory }}
145             name: {{ include "common.fullname" . }}-logs
146           resources:
147 {{ include "common.resources" . }}
148         {{- if .Values.nodeSelector }}
149         nodeSelector:
150 {{ toYaml .Values.nodeSelector | indent 10 }}
151         {{- end -}}
152         {{- if .Values.affinity }}
153         affinity:
154 {{ toYaml .Values.affinity | indent 10 }}
155         {{- end -}}
156         # Filebeat sidecar container
157         - name: {{ include "common.name" . }}-filebeat-onap
158           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
159           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
160           volumeMounts:
161           - name: {{ include "common.fullname" . }}-filebeat-conf
162             mountPath: /usr/share/filebeat/filebeat.yml
163             subPath: filebeat.yml
164           - name: {{ include "common.fullname" . }}-data-filebeat
165             mountPath: /usr/share/filebeat/data
166           - name: {{ include "common.fullname" . }}-logs
167             mountPath: /var/log/onap/datarouter-node
168       imagePullSecrets:
169       - name: "{{ include "common.namespace" . }}-docker-registry-key"
170       volumes:
171         - name: localtime
172           hostPath:
173             path: /etc/localtime
174         - name: {{ include "common.fullname" . }}-config
175           configMap:
176             name: {{ include "common.fullname" . }}-configmap
177             items:
178             - key: node.properties
179               path: node.properties
180         - name: {{ include "common.fullname" . }}-log-conf
181           configMap:
182             name: {{ include "common.fullname" . }}-log
183         - name: {{ include "common.fullname" . }}-filebeat-conf
184           configMap:
185             name: {{ include "common.fullname" . }}-dmaap-dr-node-filebeat-configmap
186         - name: {{ include "common.fullname" . }}-data-filebeat
187           emptyDir: {}
188         - name:  {{ include "common.fullname" . }}-logs
189           emptyDir: {}
190       {{- if not .Values.persistence.enabled }}
191         - name:  {{ include "common.fullname" . }}-event-logs
192           emptyDir: {}
193         - name: {{ include "common.fullname" . }}-data
194           emptyDir: {}
195       {{- if .Values.global.aafEnabled }}
196         - name:  {{ include "common.fullname" . }}-aaf-props
197           emptyDir: {}
198       {{- end }}
199       {{- end }}
200 {{- if .Values.persistence.enabled }}
201   volumeClaimTemplates:
202   - metadata:
203       name: {{ include "common.fullname" . }}-data
204       labels:
205         name: {{ include "common.fullname" . }}
206     spec:
207       accessModes:
208       - {{ .Values.persistence.accessMode }}
209       storageClassName: {{ include "common.storageClass" . }}
210       resources:
211         requests:
212           storage: {{ .Values.persistence.spoolSize }}
213   - metadata:
214       name: {{ include "common.fullname" . }}-event-logs
215       labels:
216         name: {{ include "common.fullname" . }}
217     spec:
218       accessModes:
219       - {{ .Values.persistence.accessMode }}
220       {{- if eq "True" (include "common.needPV" .) }}
221       storageClassName: "{{ include "common.fullname" . }}-data-event-logs"
222       {{- else }}
223       storageClassName: {{ include "common.storageClass" . }}
224       {{- end }}
225       resources:
226         requests:
227           storage: {{ .Values.persistence.eventLogSize }}
228 {{- if .Values.global.aafEnabled }}
229   - metadata:
230       name: {{ include "common.fullname" . }}-aaf-props
231       labels:
232         name: {{ include "common.fullname" . }}
233     spec:
234       accessModes:
235       - {{ .Values.persistence.accessMode }}
236       {{- if eq "True" (include "common.needPV" .) }}
237       storageClassName: "{{ include "common.fullname" . }}-data-aaf-props"
238       {{- else }}
239       storageClassName: {{ include "common.storageClass" . }}
240       {{- end }}
241       resources:
242         requests:
243           storage: {{ .Values.persistence.aafCredsSize }}
244 {{- end }}
245 {{- end }}