Merge "[POLICY] Disable helm endpoints by default in k8s participant"
[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: {{ include "common.certInitializer.initContainer" . | nindent 8 }}
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         - name: {{ include "common.name" . }}-permission-fixer
42           image: {{ include "repositoryGenerator.image.busybox" . }}
43           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
45           - mountPath: {{ .Values.persistence.spool.path }}
46             name: {{ include "common.fullname" . }}-spool
47           - mountPath: {{ .Values.persistence.event.path }}
48             name: {{ include "common.fullname" . }}-event-logs
49           command: ["chown","-Rf","1000:1001", "/opt/app/"]
50       containers:
51         - name: {{ include "common.name" . }}
52           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
53           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54           ports: {{ include "common.containerPorts" . | nindent 12  }}
55           {{- if eq .Values.liveness.enabled true }}
56           livenessProbe:
57             tcpSocket:
58               port: {{.Values.liveness.port}}
59             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
60             periodSeconds: {{ .Values.liveness.periodSeconds }}
61           {{ end -}}
62           readinessProbe:
63             tcpSocket:
64               port: {{.Values.readiness.port}}
65             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
66             periodSeconds: {{ .Values.readiness.periodSeconds }}
67           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
68           - mountPath: {{ .Values.persistence.spool.path }}
69             name: {{ include "common.fullname" . }}-spool
70           - mountPath: {{ .Values.persistence.event.path }}
71             name: {{ include "common.fullname" . }}-event-logs
72           - mountPath: /etc/localtime
73             name: localtime
74             readOnly: false
75           - mountPath: /opt/app/datartr/etc/node.properties
76             name: {{ include "common.fullname" . }}-config
77             subPath: node.properties
78           - mountPath: /opt/app/datartr/etc/logback.xml
79             name: {{ include "common.fullname" . }}-log-conf
80             subPath: logback.xml
81           - mountPath: {{ .Values.global.loggingDirectory }}
82             name: logs
83           resources: {{ include "common.resources" . | nindent 12 }}
84         {{- if .Values.nodeSelector }}
85         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
86         {{- end -}}
87         {{- if .Values.affinity }}
88         affinity: {{ toYaml .Values.affinity | nindent 10 }}
89         {{- end }}
90         # Filebeat sidecar container
91         {{ include "common.log.sidecar" . | nindent 8 }}
92       imagePullSecrets:
93       - name: "{{ include "common.namespace" . }}-docker-registry-key"
94       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
95       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
96         - name: localtime
97           hostPath:
98             path: /etc/localtime
99         - name: {{ include "common.fullname" . }}-config
100           configMap:
101             name: {{ include "common.fullname" . }}-configmap
102             items:
103             - key: node.properties
104               path: node.properties
105         - name: {{ include "common.fullname" . }}-log-conf
106           configMap:
107             name: {{ include "common.fullname" . }}-log
108         {{ include "common.log.volumes" . | nindent 8 }}
109         - name: logs
110           emptyDir: {}
111       {{- if not .Values.persistence.enabled }}
112         - name:  {{ include "common.fullname" . }}-event-logs
113           emptyDir: {}
114         - name: {{ include "common.fullname" . }}-spool
115           emptyDir: {}
116       {{- end }}
117 {{- if .Values.persistence.enabled }}
118   volumeClaimTemplates:
119   - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "spool" "persistenceInfos" .Values.persistence.spool) | indent 4 | trim }}
120   - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "event-logs" "persistenceInfos" .Values.persistence.event) | indent 4 | trim }}
121 {{- end }}