[COMMON] Use lowercase in common.fullname during linting in helm3
[oom.git] / kubernetes / dmaap / components / message-router / charts / message-router-zookeeper / templates / statefulset.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
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:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   serviceName: {{ .Values.service.name }}
31   replicas: {{ .Values.replicaCount }}
32   updateStrategy:
33     type: RollingUpdate
34     rollingUpdate:
35       maxUnavailable: {{ .Values.maxUnavailable }}
36   podManagementPolicy: Parallel
37   template:
38     metadata:
39       labels:
40         app: {{ include "common.name" . }}
41         release: {{ include "common.release" . }}
42       {{- if .Values.prometheus.jmx.enabled }}
43       annotations:
44         prometheus.io/scrape: "true"
45         prometheus.io/port: {{ .Values.prometheus.jmx.port | quote }}
46       {{- end }}
47     spec:
48       podAntiAffinity:
49          preferredDuringSchedulingIgnoredDuringExecution:
50          - weight: 1
51            podAffinityTerm:
52              labelSelector:
53                 matchExpressions:
54                   - key: "app"
55                     operator: In
56                     values:
57                     - {{ include "common.name" . }}
58                   - key: "release"
59                     operator: In
60                     values:
61                     - {{ include "common.release" . }}
62              topologyKey: "kubernetes.io/hostname"
63       {{- if .Values.nodeAffinity }}
64       nodeAffinity:
65         {{ toYaml .Values.nodeAffinity | indent 10 }}
66       {{- end }}
67       initContainers:
68       - name: {{ include "common.name" . }}-permission-fixer
69         command:
70         - sh
71         - -exec
72         - >
73           chown -R 1000:0 /tmp/zookeeper/apikeys;
74         image: "{{ .Values.busyBoxRepository }}/{{ .Values.busyBoxImage }}"
75         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
76         volumeMounts:
77         - mountPath: /tmp/zookeeper/apikeys
78           name: zookeeper-data
79       - command:
80         - sh
81         args:
82         - -c
83         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/etc/zookeeper/secrets/jaas/${PFILE}; done"
84         env:
85         - name: ZK_ADMIN
86           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "zk-admin" "key" "login") | indent 10 }}
87         - name: ZK_PSWD
88           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "zk-admin" "key" "password") | indent 10 }}
89         volumeMounts:
90         - mountPath: /etc/zookeeper/secrets/jaas
91           name: jaas-config
92         - mountPath: /config-input
93           name: jaas
94         image: "{{ .Values.global.envsubstImage }}"
95         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
96         name: {{ include "common.name" . }}-update-config
97       containers:
98       {{- if .Values.prometheus.jmx.enabled }}
99       - name: prometheus-jmx-exporter
100         image: "{{ .Values.prometheus.jmx.imageRepository }}/{{ .Values.prometheus.jmx.image }}:{{ .Values.prometheus.jmx.imageTag }}"
101         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
102         command:
103         - java
104         - -XX:+UnlockExperimentalVMOptions
105         - -XX:+UseCGroupMemoryLimitForHeap
106         - -XX:MaxRAMFraction=1
107         - -XshowSettings:vm
108         - -jar
109         - jmx_prometheus_httpserver.jar
110         - {{ .Values.prometheus.jmx.port | quote }}
111         - /etc/jmx-zookeeper/jmx-zookeeper-prometheus.yml
112         ports:
113         - containerPort: {{ .Values.prometheus.jmx.port }}
114         resources:
115 {{ toYaml .Values.prometheus.jmx.resources | indent 10 }}
116         volumeMounts:
117         - name: jmx-config
118           mountPath: /etc/jmx-zookeeper
119       {{- end }}
120       - name: {{ include "common.name" . }}
121         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
122         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
123         resources:
124 {{ include "common.resources" . | indent 12 }}
125         ports:
126         - containerPort: {{ .Values.service.clientPort }}
127           name: {{ .Values.service.clientPortName }}
128         - containerPort: {{ .Values.service.serverPort }}
129           name: {{ .Values.service.serverPortName }}
130         - containerPort: {{ .Values.service.leaderElectionPort }}
131           name: {{ .Values.service.leaderElectionPortName }}
132         {{- if .Values.prometheus.jmx.enabled }}
133         - containerPort: {{ .Values.jmx.port }}
134           name: jmx
135         {{- end }}
136         {{ if eq .Values.liveness.enabled true }}
137         livenessProbe:
138           exec:
139             command:  ['/bin/bash', '-c', 'echo "ruok" | nc -w 2 -q 2 localhost 2181 | grep imok']
140           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
141           periodSeconds: {{ .Values.liveness.periodSeconds }}
142           timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
143         {{ end }}
144         readinessProbe:
145           exec:
146             command: ['/bin/bash', '-c', 'echo "ruok" | nc -w 2 -q 2 localhost 2181 | grep imok']
147           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
148           periodSeconds: {{ .Values.readiness.periodSeconds }}
149           timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
150         resources:
151 {{ include "common.resources" . | indent 10 }}
152         env:
153         - name : KAFKA_HEAP_OPTS
154           value: "{{ .Values.zkConfig.heapOptions }}"
155         {{- if .Values.jmx.port }}
156         - name : KAFKA_JMX_PORT
157           value: "{{ .Values.jmx.port }}"
158         {{- end }}
159         - name : ZOOKEEPER_REPLICAS
160           value: "{{ .Values.replicaCount }}"
161         - name : ZOOKEEPER_TICK_TIME
162           value: "{{ .Values.zkConfig.tickTime }}"
163         - name : ZOOKEEPER_SYNC_LIMIT
164           value: "{{ .Values.zkConfig.syncLimit }}"
165         - name : ZOOKEEPER_INIT_LIMIT
166           value: "{{ .Values.zkConfig.initLimit }}"
167         - name : ZOOKEEPER_MAX_CLIENT_CNXNS
168           value: "{{ .Values.zkConfig.maxClientCnxns }}"
169         - name : ZOOKEEPER_AUTOPURGE_SNAP_RETAIN_COUNT
170           value: "{{ .Values.zkConfig.autoPurgeSnapRetainCount}}"
171         - name : ZOOKEEPER_AUTOPURGE_PURGE_INTERVAL
172           value: "{{ .Values.zkConfig.autoPurgePurgeInterval}}"
173         - name: ZOOKEEPER_CLIENT_PORT
174           value: "{{ .Values.zkConfig.clientPort }}"
175         - name: KAFKA_OPTS
176           value: "{{ .Values.zkConfig.kafkaOpts }}"
177         - name: ZOOKEEPER_SERVER_ID
178           valueFrom:
179             fieldRef:
180               fieldPath: metadata.name
181         command:
182         - "bash"
183         - "-c"
184         - |
185           ZOOKEEPER_SERVER_ID=$((${HOSTNAME##*-}+1)) \
186           /etc/confluent/docker/run
187         volumeMounts:
188         - mountPath: /etc/localtime
189           name: localtime
190           readOnly: true
191         - mountPath: /var/lib/zookeeper/data
192           name: zookeeper-data
193         - name: jaas-config
194           mountPath: /etc/zookeeper/secrets/jaas
195       {{- if .Values.tolerations }}
196       tolerations:
197         {{ toYaml .Values.tolerations | indent 10 }}
198       {{- end }}
199       volumes:
200       - name: localtime
201         hostPath:
202           path: /etc/localtime
203       - name: jaas-config
204         emptyDir:
205           medium: Memory
206       - name: docker-socket
207         hostPath:
208           path: /var/run/docker.sock
209       - name: jaas
210         configMap:
211           name: {{ include "common.fullname" . }}-jaas-configmap
212        {{- if .Values.prometheus.jmx.enabled }}
213       - name: jmx-config
214         configMap:
215            name: {{ include "common.fullname" . }}-prometheus-configmap
216        {{- end }}
217 {{ if not .Values.persistence.enabled }}
218       - name: zookeeper-data
219         emptyDir: {}
220 {{ else }}
221   volumeClaimTemplates:
222     - metadata:
223         name: zookeeper-data
224         labels:
225           app: {{ include "common.fullname" . }}
226           chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
227           release: "{{ include "common.release" . }}"
228           heritage: "{{ .Release.Service }}"
229       spec:
230         accessModes:
231           - {{ .Values.persistence.accessMode | quote }}
232         storageClassName: {{ include "common.storageClass" . }}
233         resources:
234           requests:
235             storage: {{ .Values.persistence.size | quote }}
236 {{ end }}
237       imagePullSecrets:
238       - name: "{{ include "common.namespace" . }}-docker-registry-key"