Merge "[DCAEMOD] Uses new tpls for repos / images"
[oom.git] / kubernetes / dmaap / components / dmaap-dr-node / templates / statefulset.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16 apiVersion: apps/v1
17 kind: StatefulSet
18 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
19 spec:
20   selector: {{- include "common.selectors" . | nindent 4 }}
21   serviceName: {{ include "common.servicename" . }}
22   replicas: {{ .Values.replicaCount }}
23   template:
24     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
25     spec:
26       initContainers:
27         - name: {{ include "common.name" . }}-readiness
28           image: {{ include "repositoryGenerator.image.readiness" . }}
29           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
30           command:
31           - /app/ready.py
32           args:
33           - --container-name
34           - dmaap-dr-prov
35           env:
36           - name: NAMESPACE
37             valueFrom:
38               fieldRef:
39                 apiVersion: v1
40                 fieldPath: metadata.namespace
41         {{- if .Values.global.aafEnabled }}{{ include "common.aaf-config" . | nindent 8 }}{{ end }}
42         - name: {{ include "common.name" . }}-permission-fixer
43           image: {{ include "repositoryGenerator.image.busybox" . }}
44           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45           volumeMounts: {{- if .Values.global.aafEnabled }}{{ include "common.aaf-config-volume-mountpath" . | nindent 10 }}{{ end }}
46           - mountPath: {{ .Values.persistence.spool.path }}
47             name: {{ include "common.fullname" . }}-spool
48           - mountPath: {{ .Values.persistence.event.path }}
49             name: {{ include "common.fullname" . }}-event-logs
50           command: ["chown","-Rf","1000:1001", "/opt/app/"]
51       containers:
52         - name: {{ include "common.name" . }}
53           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
54           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55           ports: {{ include "common.containerPorts" . | nindent 12  }}
56           {{- if eq .Values.liveness.enabled true }}
57           livenessProbe:
58             tcpSocket:
59               port: {{.Values.liveness.port}}
60             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
61             periodSeconds: {{ .Values.liveness.periodSeconds }}
62           {{ end -}}
63           readinessProbe:
64             tcpSocket:
65               port: {{.Values.readiness.port}}
66             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
67             periodSeconds: {{ .Values.readiness.periodSeconds }}
68           volumeMounts: {{- if .Values.global.aafEnabled }}{{ include "common.aaf-config-volume-mountpath" . | nindent 10 }}{{ end }}
69           - mountPath: {{ .Values.persistence.spool.path }}
70             name: {{ include "common.fullname" . }}-spool
71           - mountPath: {{ .Values.persistence.event.path }}
72             name: {{ include "common.fullname" . }}-event-logs
73           - mountPath: /etc/localtime
74             name: localtime
75             readOnly: false
76           - mountPath: /opt/app/datartr/etc/node.properties
77             name: {{ include "common.fullname" . }}-config
78             subPath: node.properties
79           - mountPath: /opt/app/datartr/etc/logback.xml
80             name: {{ include "common.fullname" . }}-log-conf
81             subPath: logback.xml
82           - mountPath: {{ .Values.global.loggingDirectory }}
83             name: {{ include "common.fullname" . }}-logs
84           resources: {{ include "common.resources" . | nindent 12 }}
85         {{- if .Values.nodeSelector }}
86         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
87         {{- end -}}
88         {{- if .Values.affinity }}
89         affinity: {{ toYaml .Values.affinity | nindent 10 }}
90         {{- end -}}
91         # Filebeat sidecar container
92         - name: {{ include "common.name" . }}-filebeat-onap
93           image: {{ include "repositoryGenerator.image.logging" . }}
94           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
95           volumeMounts:
96           - name: {{ include "common.fullname" . }}-filebeat-conf
97             mountPath: /usr/share/filebeat/filebeat.yml
98             subPath: filebeat.yml
99           - name: {{ include "common.fullname" . }}-data-filebeat
100             mountPath: /usr/share/filebeat/data
101           - name: {{ include "common.fullname" . }}-logs
102             mountPath: /var/log/onap/datarouter-node
103       imagePullSecrets:
104       - name: "{{ include "common.namespace" . }}-docker-registry-key"
105       volumes: {{ include "common.aaf-config-volumes" . | nindent 8 }}
106         - name: localtime
107           hostPath:
108             path: /etc/localtime
109         - name: {{ include "common.fullname" . }}-config
110           configMap:
111             name: {{ include "common.fullname" . }}-configmap
112             items:
113             - key: node.properties
114               path: node.properties
115         - name: {{ include "common.fullname" . }}-log-conf
116           configMap:
117             name: {{ include "common.fullname" . }}-log
118         - name: {{ include "common.fullname" . }}-filebeat-conf
119           configMap:
120             name: {{ include "common.fullname" . }}-dmaap-dr-node-filebeat-configmap
121         - name: {{ include "common.fullname" . }}-data-filebeat
122           emptyDir: {}
123         - name:  {{ include "common.fullname" . }}-logs
124           emptyDir: {}
125       {{- if not .Values.persistence.enabled }}
126         - name:  {{ include "common.fullname" . }}-event-logs
127           emptyDir: {}
128         - name: {{ include "common.fullname" . }}-spool
129           emptyDir: {}
130       {{- end }}
131 {{- if .Values.persistence.enabled }}
132   volumeClaimTemplates:
133   - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "spool" "persistenceInfos" .Values.persistence.spool) | indent 4 | trim }}
134   - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "event-logs" "persistenceInfos" .Values.persistence.event) | indent 4 | trim }}
135 {{- end }}