Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[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       {{ include "common.podSecurityContext" . | indent 6 | trim}}
27       initContainers: {{ include "common.certInitializer.initContainer" . | nindent 8 }}
28         - name: {{ include "common.name" . }}-readiness
29           securityContext:
30             runAsUser: 100
31             runAsGroup: 65533
32           image: {{ include "repositoryGenerator.image.readiness" . }}
33           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
34           command:
35           - /app/ready.py
36           args:
37           - --container-name
38           - dmaap-dr-prov
39           env:
40           - name: NAMESPACE
41             valueFrom:
42               fieldRef:
43                 apiVersion: v1
44                 fieldPath: metadata.namespace
45         - name: {{ include "common.name" . }}-permission-fixer
46           securityContext:
47             runAsUser: 0
48           image: {{ include "repositoryGenerator.image.busybox" . }}
49           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
51           - mountPath: {{ .Values.persistence.spool.path }}
52             name: {{ include "common.fullname" . }}-spool
53           - mountPath: {{ .Values.persistence.event.path }}
54             name: {{ include "common.fullname" . }}-event-logs
55           command: ["chown","-Rf","1000:1001", "/opt/app/"]
56       containers:
57         - name: {{ include "common.name" . }}
58           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
59           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60           ports: {{ include "common.containerPorts" . | nindent 12  }}
61           {{- if eq .Values.liveness.enabled true }}
62           livenessProbe:
63             tcpSocket:
64               port: {{.Values.liveness.port}}
65             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
66             periodSeconds: {{ .Values.liveness.periodSeconds }}
67           {{ end -}}
68           readinessProbe:
69             tcpSocket:
70               port: {{.Values.readiness.port}}
71             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
72             periodSeconds: {{ .Values.readiness.periodSeconds }}
73           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
74           - mountPath: {{ .Values.persistence.spool.path }}
75             name: {{ include "common.fullname" . }}-spool
76           - mountPath: {{ .Values.persistence.event.path }}
77             name: {{ include "common.fullname" . }}-event-logs
78           - mountPath: /etc/localtime
79             name: localtime
80             readOnly: false
81           - mountPath: /opt/app/datartr/etc/node.properties
82             name: {{ include "common.fullname" . }}-config
83             subPath: node.properties
84           - mountPath: /opt/app/datartr/etc/logback.xml
85             name: {{ include "common.fullname" . }}-log-conf
86             subPath: logback.xml
87           - mountPath: {{ .Values.global.loggingDirectory }}
88             name: logs
89           resources: {{ include "common.resources" . | nindent 12 }}
90         {{- if .Values.nodeSelector }}
91         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
92         {{- end -}}
93         {{- if .Values.affinity }}
94         affinity: {{ toYaml .Values.affinity | nindent 10 }}
95         {{- end }}
96         # Filebeat sidecar container
97         {{ include "common.log.sidecar" . | nindent 8 }}
98       imagePullSecrets:
99       - name: "{{ include "common.namespace" . }}-docker-registry-key"
100       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
101       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
102         - name: localtime
103           hostPath:
104             path: /etc/localtime
105         - name: {{ include "common.fullname" . }}-config
106           configMap:
107             name: {{ include "common.fullname" . }}-configmap
108             items:
109             - key: node.properties
110               path: node.properties
111         - name: {{ include "common.fullname" . }}-log-conf
112           configMap:
113             name: {{ include "common.fullname" . }}-log
114         {{ include "common.log.volumes" . | nindent 8 }}
115         - name: logs
116           emptyDir: {}
117       {{- if not .Values.persistence.enabled }}
118         - name:  {{ include "common.fullname" . }}-event-logs
119           emptyDir: {}
120         - name: {{ include "common.fullname" . }}-spool
121           emptyDir: {}
122       {{- end }}
123 {{- if .Values.persistence.enabled }}
124   volumeClaimTemplates:
125   - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "spool" "persistenceInfos" .Values.persistence.spool) | indent 4 | trim }}
126   - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "event-logs" "persistenceInfos" .Values.persistence.event) | indent 4 | trim }}
127 {{- end }}