statefulset.yaml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
  2. kind: StatefulSet
  3. metadata:
  4. name: {{ template "common.names.fullname" . }}
  5. namespace: {{ template "zookeeper.namespace" . }}
  6. labels: {{- include "common.labels.standard" . | nindent 4 }}
  7. app.kubernetes.io/component: zookeeper
  8. role: zookeeper
  9. {{- if .Values.commonLabels }}
  10. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  11. {{- end }}
  12. {{- if .Values.commonAnnotations }}
  13. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  14. {{- end }}
  15. spec:
  16. replicas: {{ .Values.replicaCount }}
  17. podManagementPolicy: {{ .Values.podManagementPolicy }}
  18. selector:
  19. matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
  20. app.kubernetes.io/component: zookeeper
  21. serviceName: {{ printf "%s-%s" (include "common.names.fullname" .) (default "headless" .Values.service.headless.servicenameOverride) | trunc 63 | trimSuffix "-" }}
  22. {{- if .Values.updateStrategy }}
  23. updateStrategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
  24. {{- end }}
  25. template:
  26. metadata:
  27. annotations:
  28. {{- if .Values.podAnnotations }}
  29. {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
  30. {{- end }}
  31. {{- if (include "zookeeper.createConfigmap" .) }}
  32. checksum/configuration: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
  33. {{- end }}
  34. {{- if or (include "zookeeper.quorum.createSecret" .) (include "zookeeper.client.createSecret" .) (include "zookeeper.client.createTlsPasswordsSecret" .) (include "zookeeper.quorum.createTlsPasswordsSecret" .) }}
  35. checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
  36. {{- end }}
  37. {{- if or (include "zookeeper.client.createTlsSecret" .) (include "zookeeper.quorum.createTlsSecret" .) }}
  38. checksum/tls-secrets: {{ include (print $.Template.BasePath "/tls-secrets.yaml") . | sha256sum }}
  39. {{- end }}
  40. labels: {{- include "common.labels.standard" . | nindent 8 }}
  41. app.kubernetes.io/component: zookeeper
  42. {{- if .Values.podLabels }}
  43. {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
  44. {{- end }}
  45. spec:
  46. serviceAccountName: {{ template "zookeeper.serviceAccountName" . }}
  47. {{- include "zookeeper.imagePullSecrets" . | nindent 6 }}
  48. {{- if .Values.hostAliases }}
  49. hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
  50. {{- end }}
  51. {{- if .Values.affinity }}
  52. affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
  53. {{- else }}
  54. affinity:
  55. podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" "zookeeper" "context" $) | nindent 10 }}
  56. podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" "zookeeper" "context" $) | nindent 10 }}
  57. nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
  58. {{- end }}
  59. {{- if .Values.nodeSelector }}
  60. nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
  61. {{- end }}
  62. {{- if .Values.tolerations }}
  63. tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
  64. {{- end }}
  65. {{- if .Values.topologySpreadConstraints }}
  66. topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.topologySpreadConstraints "context" .) | nindent 8 }}
  67. {{- end }}
  68. {{- if .Values.priorityClassName }}
  69. priorityClassName: {{ .Values.priorityClassName }}
  70. {{- end }}
  71. {{- if .Values.schedulerName }}
  72. schedulerName: {{ .Values.schedulerName }}
  73. {{- end }}
  74. {{- if .Values.podSecurityContext.enabled }}
  75. securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
  76. {{- end }}
  77. initContainers:
  78. {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
  79. - name: volume-permissions
  80. image: {{ template "zookeeper.volumePermissions.image" . }}
  81. imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
  82. command:
  83. - /bin/bash
  84. args:
  85. - -ec
  86. - |
  87. mkdir -p /bitnami/zookeeper
  88. chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }} /bitnami/zookeeper
  89. find /bitnami/zookeeper -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }}
  90. {{- if .Values.dataLogDir }}
  91. mkdir -p {{ .Values.dataLogDir }}
  92. chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }} {{ .Values.dataLogDir }}
  93. find {{ .Values.dataLogDir }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }}
  94. {{- end }}
  95. {{- if .Values.volumePermissions.containerSecurityContext.enabled }}
  96. securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "enabled" | toYaml | nindent 12 }}
  97. {{- end }}
  98. {{- if .Values.volumePermissions.resources }}
  99. resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
  100. {{- end }}
  101. volumeMounts:
  102. - name: data
  103. mountPath: /bitnami/zookeeper
  104. {{- if .Values.dataLogDir }}
  105. - name: data-log
  106. mountPath: {{ .Values.dataLogDir }}
  107. {{- end }}
  108. {{- end }}
  109. {{- if or .Values.tls.client.enabled .Values.tls.quorum.enabled }}
  110. - name: init-certs
  111. image: {{ include "zookeeper.image" . }}
  112. imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
  113. {{- if .Values.containerSecurityContext.enabled }}
  114. securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
  115. {{- end }}
  116. command:
  117. - /scripts/init-certs.sh
  118. env:
  119. - name: MY_POD_NAME
  120. valueFrom:
  121. fieldRef:
  122. apiVersion: v1
  123. fieldPath: metadata.name
  124. {{- if or .Values.tls.client.passwordsSecretName (include "zookeeper.client.createTlsPasswordsSecret" .) }}
  125. - name: ZOO_TLS_CLIENT_KEYSTORE_PASSWORD
  126. valueFrom:
  127. secretKeyRef:
  128. name: {{ include "zookeeper.client.tlsPasswordsSecret" . }}
  129. key: {{ include "zookeeper.client.tlsPasswordKeystoreKey" . }}
  130. - name: ZOO_TLS_CLIENT_TRUSTSTORE_PASSWORD
  131. valueFrom:
  132. secretKeyRef:
  133. name: {{ include "zookeeper.client.tlsPasswordsSecret" . }}
  134. key: {{ include "zookeeper.client.tlsPasswordTruststoreKey" . }}
  135. {{- end }}
  136. {{- if or .Values.tls.quorum.passwordsSecretName (include "zookeeper.quorum.createTlsPasswordsSecret" .) }}
  137. - name: ZOO_TLS_QUORUM_KEYSTORE_PASSWORD
  138. valueFrom:
  139. secretKeyRef:
  140. name: {{ include "zookeeper.quorum.tlsPasswordsSecret" . }}
  141. key: {{ include "zookeeper.quorum.tlsPasswordKeystoreKey" . }}
  142. - name: ZOO_TLS_QUORUM_TRUSTSTORE_PASSWORD
  143. valueFrom:
  144. secretKeyRef:
  145. name: {{ include "zookeeper.quorum.tlsPasswordsSecret" . }}
  146. key: {{ include "zookeeper.quorum.tlsPasswordTruststoreKey" . }}
  147. {{- end }}
  148. {{- if .Values.tls.resources }}
  149. resources: {{- toYaml .Values.tls.resources | nindent 12 }}
  150. {{- end }}
  151. volumeMounts:
  152. - name: scripts
  153. mountPath: /scripts/init-certs.sh
  154. subPath: init-certs.sh
  155. {{- if or .Values.tls.client.enabled }}
  156. - name: client-certificates
  157. mountPath: /certs/client
  158. - name: client-shared-certs
  159. mountPath: /opt/bitnami/zookeeper/config/certs/client
  160. {{- end }}
  161. {{- if or .Values.tls.quorum.enabled }}
  162. - name: quorum-certificates
  163. mountPath: /certs/quorum
  164. - name: quorum-shared-certs
  165. mountPath: /opt/bitnami/zookeeper/config/certs/quorum
  166. {{- end }}
  167. {{- end }}
  168. {{- if .Values.initContainers }}
  169. {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | trim | nindent 8 }}
  170. {{- end }}
  171. containers:
  172. - name: zookeeper
  173. image: {{ template "zookeeper.image" . }}
  174. imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
  175. {{- if .Values.containerSecurityContext.enabled }}
  176. securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
  177. {{- end }}
  178. {{- if .Values.diagnosticMode.enabled }}
  179. command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
  180. {{- else if .Values.command }}
  181. command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
  182. {{- end }}
  183. {{- if .Values.diagnosticMode.enabled }}
  184. args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
  185. {{- else if .Values.args }}
  186. args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
  187. {{- end }}
  188. {{- if .Values.resources }}
  189. resources: {{- toYaml .Values.resources | nindent 12 }}
  190. {{- end }}
  191. env:
  192. - name: BITNAMI_DEBUG
  193. value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
  194. - name: ZOO_DATA_LOG_DIR
  195. value: {{ .Values.dataLogDir | quote }}
  196. - name: ZOO_PORT_NUMBER
  197. value: {{ .Values.containerPorts.client | quote }}
  198. - name: ZOO_TICK_TIME
  199. value: {{ .Values.tickTime | quote }}
  200. - name: ZOO_INIT_LIMIT
  201. value: {{ .Values.initLimit | quote }}
  202. - name: ZOO_SYNC_LIMIT
  203. value: {{ .Values.syncLimit | quote }}
  204. - name: ZOO_PRE_ALLOC_SIZE
  205. value: {{ .Values.preAllocSize | quote }}
  206. - name: ZOO_SNAPCOUNT
  207. value: {{ .Values.snapCount | quote }}
  208. - name: ZOO_MAX_CLIENT_CNXNS
  209. value: {{ .Values.maxClientCnxns | quote }}
  210. - name: ZOO_4LW_COMMANDS_WHITELIST
  211. value: {{ .Values.fourlwCommandsWhitelist | quote }}
  212. - name: ZOO_LISTEN_ALLIPS_ENABLED
  213. value: {{ ternary "yes" "no" .Values.listenOnAllIPs | quote }}
  214. - name: ZOO_AUTOPURGE_INTERVAL
  215. value: {{ .Values.autopurge.purgeInterval | quote }}
  216. - name: ZOO_AUTOPURGE_RETAIN_COUNT
  217. value: {{ .Values.autopurge.snapRetainCount | quote }}
  218. - name: ZOO_MAX_SESSION_TIMEOUT
  219. value: {{ .Values.maxSessionTimeout | quote }}
  220. - name: ZOO_SERVERS
  221. {{- $replicaCount := int .Values.replicaCount }}
  222. {{- $minServerId := int .Values.minServerId }}
  223. {{- $followerPort := int .Values.containerPorts.follower }}
  224. {{- $electionPort := int .Values.containerPorts.election }}
  225. {{- $releaseNamespace := include "zookeeper.namespace" . }}
  226. {{- $zookeeperFullname := include "common.names.fullname" . }}
  227. {{- $zookeeperHeadlessServiceName := printf "%s-%s" $zookeeperFullname "headless" | trunc 63 }}
  228. {{- $clusterDomain := .Values.clusterDomain }}
  229. value: {{ range $i, $e := until $replicaCount }}{{ $zookeeperFullname }}-{{ $e }}.{{ $zookeeperHeadlessServiceName }}.{{ $releaseNamespace }}.svc.{{ $clusterDomain }}:{{ $followerPort }}:{{ $electionPort }}::{{ add $e $minServerId }} {{ end }}
  230. - name: ZOO_ENABLE_AUTH
  231. value: {{ ternary "yes" "no" .Values.auth.client.enabled | quote }}
  232. {{- if .Values.auth.client.enabled }}
  233. - name: ZOO_CLIENT_USER
  234. value: {{ .Values.auth.client.clientUser | quote }}
  235. - name: ZOO_CLIENT_PASSWORD
  236. valueFrom:
  237. secretKeyRef:
  238. name: {{ include "zookeeper.client.secretName" . }}
  239. key: client-password
  240. - name: ZOO_SERVER_USERS
  241. value: {{ .Values.auth.client.serverUsers | quote }}
  242. - name: ZOO_SERVER_PASSWORDS
  243. valueFrom:
  244. secretKeyRef:
  245. name: {{ include "zookeeper.client.secretName" . }}
  246. key: server-password
  247. {{- end }}
  248. - name: ZOO_ENABLE_QUORUM_AUTH
  249. value: {{ ternary "yes" "no" .Values.auth.quorum.enabled | quote }}
  250. {{- if .Values.auth.quorum.enabled }}
  251. - name: ZOO_QUORUM_LEARNER_USER
  252. value: {{ .Values.auth.quorum.learnerUser | quote }}
  253. - name: ZOO_QUORUM_LEARNER_PASSWORD
  254. valueFrom:
  255. secretKeyRef:
  256. name: {{ include "zookeeper.quorum.secretName" . }}
  257. key: quorum-learner-password
  258. - name: ZOO_QUORUM_SERVER_USERS
  259. value: {{ .Values.auth.quorum.serverUsers | quote }}
  260. - name: ZOO_QUORUM_SERVER_PASSWORDS
  261. valueFrom:
  262. secretKeyRef:
  263. name: {{ include "zookeeper.quorum.secretName" . }}
  264. key: quorum-server-password
  265. {{- end }}
  266. - name: ZOO_HEAP_SIZE
  267. value: {{ .Values.heapSize | quote }}
  268. - name: ZOO_LOG_LEVEL
  269. value: {{ .Values.logLevel | quote }}
  270. - name: ALLOW_ANONYMOUS_LOGIN
  271. value: {{ ternary "no" "yes" .Values.auth.client.enabled | quote }}
  272. {{- if .Values.jvmFlags }}
  273. - name: JVMFLAGS
  274. value: {{ .Values.jvmFlags | quote }}
  275. {{- end }}
  276. {{- if .Values.metrics.enabled }}
  277. - name: ZOO_ENABLE_PROMETHEUS_METRICS
  278. value: "yes"
  279. - name: ZOO_PROMETHEUS_METRICS_PORT_NUMBER
  280. value: {{ .Values.metrics.containerPort | quote }}
  281. {{- end }}
  282. {{- if .Values.tls.client.enabled }}
  283. - name: ZOO_TLS_PORT_NUMBER
  284. value: {{ .Values.containerPorts.tls | quote }}
  285. - name: ZOO_TLS_CLIENT_ENABLE
  286. value: {{ .Values.tls.client.enabled | quote }}
  287. - name: ZOO_TLS_CLIENT_AUTH
  288. value: {{ .Values.tls.client.auth | quote }}
  289. - name: ZOO_TLS_CLIENT_KEYSTORE_FILE
  290. value: {{ .Values.tls.client.keystorePath | quote }}
  291. - name: ZOO_TLS_CLIENT_TRUSTSTORE_FILE
  292. value: {{ .Values.tls.client.truststorePath | quote }}
  293. {{- if or .Values.tls.client.keystorePassword .Values.tls.client.passwordsSecretName .Values.tls.client.autoGenerated }}
  294. - name: ZOO_TLS_CLIENT_KEYSTORE_PASSWORD
  295. valueFrom:
  296. secretKeyRef:
  297. name: {{ include "zookeeper.client.tlsPasswordsSecret" . }}
  298. key: {{ include "zookeeper.client.tlsPasswordKeystoreKey" . }}
  299. {{- end }}
  300. {{- if or .Values.tls.client.truststorePassword .Values.tls.client.passwordsSecretName .Values.tls.client.autoGenerated }}
  301. - name: ZOO_TLS_CLIENT_TRUSTSTORE_PASSWORD
  302. valueFrom:
  303. secretKeyRef:
  304. name: {{ include "zookeeper.client.tlsPasswordsSecret" . }}
  305. key: {{ include "zookeeper.client.tlsPasswordTruststoreKey" . }}
  306. {{- end }}
  307. {{- end }}
  308. {{- if .Values.tls.quorum.enabled }}
  309. - name: ZOO_TLS_QUORUM_ENABLE
  310. value: {{ .Values.tls.quorum.enabled | quote }}
  311. - name: ZOO_TLS_QUORUM_CLIENT_AUTH
  312. value: {{ .Values.tls.quorum.auth | quote }}
  313. - name: ZOO_TLS_QUORUM_KEYSTORE_FILE
  314. value: {{ .Values.tls.quorum.keystorePath | quote }}
  315. - name: ZOO_TLS_QUORUM_TRUSTSTORE_FILE
  316. value: {{ .Values.tls.quorum.truststorePath | quote }}
  317. {{- if or .Values.tls.quorum.keystorePassword .Values.tls.quorum.passwordsSecretName .Values.tls.quorum.autoGenerated }}
  318. - name: ZOO_TLS_QUORUM_KEYSTORE_PASSWORD
  319. valueFrom:
  320. secretKeyRef:
  321. name: {{ include "zookeeper.quorum.tlsPasswordsSecret" . }}
  322. key: {{ include "zookeeper.quorum.tlsPasswordKeystoreKey" . }}
  323. {{- end }}
  324. {{- if or .Values.tls.quorum.truststorePassword .Values.tls.quorum.passwordsSecretName .Values.tls.quorum.autoGenerated }}
  325. - name: ZOO_TLS_QUORUM_TRUSTSTORE_PASSWORD
  326. valueFrom:
  327. secretKeyRef:
  328. name: {{ include "zookeeper.quorum.tlsPasswordsSecret" . }}
  329. key: {{ include "zookeeper.quorum.tlsPasswordTruststoreKey" . }}
  330. {{- end }}
  331. {{- end }}
  332. - name: POD_NAME
  333. valueFrom:
  334. fieldRef:
  335. apiVersion: v1
  336. fieldPath: metadata.name
  337. {{- if .Values.extraEnvVars }}
  338. {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
  339. {{- end }}
  340. {{- if or .Values.extraEnvVarsCM .Values.extraEnvVarsSecret }}
  341. envFrom:
  342. {{- if .Values.extraEnvVarsCM }}
  343. - configMapRef:
  344. name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
  345. {{- end }}
  346. {{- if .Values.extraEnvVarsSecret }}
  347. - secretRef:
  348. name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
  349. {{- end }}
  350. {{- end }}
  351. ports:
  352. {{- if not .Values.service.disableBaseClientPort }}
  353. - name: client
  354. containerPort: {{ .Values.containerPorts.client }}
  355. {{- end }}
  356. {{- if .Values.tls.client.enabled }}
  357. - name: client-tls
  358. containerPort: {{ .Values.containerPorts.tls }}
  359. {{- end }}
  360. - name: follower
  361. containerPort: {{ .Values.containerPorts.follower }}
  362. - name: election
  363. containerPort: {{ .Values.containerPorts.election }}
  364. {{- if .Values.metrics.enabled }}
  365. - name: metrics
  366. containerPort: {{ .Values.metrics.containerPort }}
  367. {{- end }}
  368. {{- if not .Values.diagnosticMode.enabled }}
  369. {{- if .Values.customLivenessProbe }}
  370. livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
  371. {{- else if .Values.livenessProbe.enabled }}
  372. livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled" "probeCommandTimeout") "context" $) | nindent 12 }}
  373. exec:
  374. {{- if not .Values.service.disableBaseClientPort }}
  375. command: ['/bin/bash', '-c', 'echo "ruok" | timeout {{ .Values.livenessProbe.probeCommandTimeout }} nc -w {{ .Values.livenessProbe.probeCommandTimeout }} localhost {{ .Values.containerPorts.client }} | grep imok']
  376. {{- else if not .Values.tls.client.enabled }}
  377. command: ['/bin/bash', '-c', 'echo "ruok" | timeout {{ .Values.livenessProbe.probeCommandTimeout }} openssl s_client -quiet -crlf -connect localhost:{{ .Values.containerPorts.tls }} | grep imok']
  378. {{- else }}
  379. command: ['/bin/bash', '-c', 'echo "ruok" | timeout {{ .Values.livenessProbe.probeCommandTimeout }} openssl s_client -quiet -crlf -connect localhost:{{ .Values.containerPorts.tls }} -cert {{ .Values.service.tls.client_cert_pem_path }} -key {{ .Values.service.tls.client_key_pem_path }} | grep imok']
  380. {{- end }}
  381. {{- end }}
  382. {{- if .Values.customReadinessProbe }}
  383. readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
  384. {{- else if .Values.readinessProbe.enabled }}
  385. readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled" "probeCommandTimeout") "context" $) | nindent 12 }}
  386. exec:
  387. {{- if not .Values.service.disableBaseClientPort }}
  388. command: ['/bin/bash', '-c', 'echo "ruok" | timeout {{ .Values.readinessProbe.probeCommandTimeout }} nc -w {{ .Values.readinessProbe.probeCommandTimeout }} localhost {{ .Values.containerPorts.client }} | grep imok']
  389. {{- else if not .Values.tls.client.enabled }}
  390. command: ['/bin/bash', '-c', 'echo "ruok" | timeout {{ .Values.readinessProbe.probeCommandTimeout }} openssl s_client -quiet -crlf -connect localhost:{{ .Values.containerPorts.tls }} | grep imok']
  391. {{- else }}
  392. command: ['/bin/bash', '-c', 'echo "ruok" | timeout {{ .Values.readinessProbe.probeCommandTimeout }} openssl s_client -quiet -crlf -connect localhost:{{ .Values.containerPorts.tls }} -cert {{ .Values.service.tls.client_cert_pem_path }} -key {{ .Values.service.tls.client_key_pem_path }} | grep imok']
  393. {{- end }}
  394. {{- end }}
  395. {{- if .Values.customStartupProbe }}
  396. startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
  397. {{- else if .Values.startupProbe.enabled }}
  398. startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }}
  399. tcpSocket:
  400. {{- if not .Values.service.disableBaseClientPort }}
  401. port: client
  402. {{- else }}
  403. port: follower
  404. {{- end }}
  405. {{- end }}
  406. {{- end }}
  407. {{- if .Values.lifecycleHooks }}
  408. lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
  409. {{- end }}
  410. volumeMounts:
  411. - name: scripts
  412. mountPath: /scripts/setup.sh
  413. subPath: setup.sh
  414. - name: data
  415. mountPath: /bitnami/zookeeper
  416. {{- if .Values.dataLogDir }}
  417. - name: data-log
  418. mountPath: {{ .Values.dataLogDir }}
  419. {{- end }}
  420. {{- if or .Values.configuration .Values.existingConfigmap }}
  421. - name: config
  422. mountPath: /opt/bitnami/zookeeper/conf/zoo.cfg
  423. subPath: zoo.cfg
  424. {{- end }}
  425. {{- if .Values.tls.client.enabled }}
  426. - name: client-shared-certs
  427. mountPath: /opt/bitnami/zookeeper/config/certs/client
  428. readOnly: true
  429. {{- end }}
  430. {{- if .Values.tls.quorum.enabled }}
  431. - name: quorum-shared-certs
  432. mountPath: /opt/bitnami/zookeeper/config/certs/quorum
  433. readOnly: true
  434. {{- end }}
  435. {{- if .Values.extraVolumeMounts }}
  436. {{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumeMounts "context" $ ) | nindent 12 }}
  437. {{- end }}
  438. {{- if .Values.sidecars }}
  439. {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $ ) | nindent 8 }}
  440. {{- end }}
  441. volumes:
  442. - name: scripts
  443. configMap:
  444. name: {{ printf "%s-scripts" (include "common.names.fullname" .) }}
  445. defaultMode: 0755
  446. {{- if or .Values.configuration .Values.existingConfigmap }}
  447. - name: config
  448. configMap:
  449. name: {{ include "zookeeper.configmapName" . }}
  450. {{- end }}
  451. {{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
  452. - name: data
  453. persistentVolumeClaim:
  454. claimName: {{ printf "%s" (tpl .Values.persistence.existingClaim .) }}
  455. {{- else if not .Values.persistence.enabled }}
  456. - name: data
  457. emptyDir: {}
  458. {{- end }}
  459. {{- if and .Values.persistence.enabled .Values.persistence.dataLogDir.existingClaim }}
  460. - name: data-log
  461. persistentVolumeClaim:
  462. claimName: {{ printf "%s" (tpl .Values.persistence.dataLogDir.existingClaim .) }}
  463. {{- else if and ( not .Values.persistence.enabled ) .Values.dataLogDir }}
  464. - name: data-log
  465. emptyDir: {}
  466. {{- end }}
  467. {{- if .Values.tls.client.enabled }}
  468. - name: client-certificates
  469. secret:
  470. secretName: {{ include "zookeeper.client.tlsSecretName" . }}
  471. defaultMode: 256
  472. - name: client-shared-certs
  473. emptyDir: {}
  474. {{- end }}
  475. {{- if .Values.tls.quorum.enabled }}
  476. - name: quorum-certificates
  477. secret:
  478. secretName: {{ include "zookeeper.quorum.tlsSecretName" . }}
  479. defaultMode: 256
  480. - name: quorum-shared-certs
  481. emptyDir: {}
  482. {{- end }}
  483. {{- if .Values.extraVolumes }}
  484. {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
  485. {{- end }}
  486. {{- if and .Values.persistence.enabled (not (and .Values.persistence.existingClaim .Values.persistence.dataLogDir.existingClaim) ) }}
  487. volumeClaimTemplates:
  488. {{- if not .Values.persistence.existingClaim }}
  489. - metadata:
  490. name: data
  491. {{- if .Values.persistence.annotations }}
  492. annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
  493. {{- end }}
  494. {{- if .Values.persistence.labels }}
  495. labels: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.labels "context" $) | nindent 10 }}
  496. {{- end }}
  497. spec:
  498. accessModes:
  499. {{- range .Values.persistence.accessModes }}
  500. - {{ . | quote }}
  501. {{- end }}
  502. resources:
  503. requests:
  504. storage: {{ .Values.persistence.size | quote }}
  505. {{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) | nindent 8 }}
  506. {{- if .Values.persistence.selector }}
  507. selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.selector "context" $) | nindent 10 }}
  508. {{- end }}
  509. {{- end }}
  510. {{- if and (not .Values.persistence.dataLogDir.existingClaim) .Values.dataLogDir }}
  511. - metadata:
  512. name: data-log
  513. {{- if .Values.persistence.annotations }}
  514. annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
  515. {{- end }}
  516. {{- if .Values.persistence.labels }}
  517. labels: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.labels "context" $) | nindent 10 }}
  518. {{- end }}
  519. spec:
  520. accessModes:
  521. {{- range .Values.persistence.accessModes }}
  522. - {{ . | quote }}
  523. {{- end }}
  524. resources:
  525. requests:
  526. storage: {{ .Values.persistence.dataLogDir.size | quote }}
  527. {{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) | nindent 8 }}
  528. {{- if .Values.persistence.dataLogDir.selector }}
  529. selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.dataLogDir.selector "context" $) | nindent 10 }}
  530. {{- end }}
  531. {{- end }}
  532. {{- end }}