| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| {{- if not .Values.controller.lean }} |
| --- |
| apiVersion: apps/v1 |
| kind: StatefulSet |
| metadata: |
| name: {{ .Release.Name }}-zookeeper |
| labels: |
| name: {{ .Release.Name }}-zookeeper |
| {{ include "openwhisk.label_boilerplate" . | indent 4 }} |
| spec: |
| serviceName: {{ .Release.Name }}-zookeeper |
| podManagementPolicy: "Parallel" |
| replicas: {{ .Values.zookeeper.replicaCount }} |
| selector: |
| matchLabels: |
| name: {{ .Release.Name }}-zookeeper |
| template: |
| metadata: |
| labels: |
| name: {{ .Release.Name }}-zookeeper |
| {{ include "openwhisk.label_boilerplate" . | indent 8 }} |
| spec: |
| restartPolicy: {{ .Values.zookeeper.restartPolicy | quote }} |
| |
| {{- if .Values.affinity.enabled }} |
| affinity: |
| {{ include "openwhisk.affinity.core" . | indent 8 }} |
| {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-zookeeper" .Release.Name ) | indent 8 }} |
| {{- end }} |
| |
| volumes: |
| - name: zk-config |
| configMap: |
| name: {{ .Release.Name }}-zookeeper |
| {{- if and .Values.k8s.persistence.enabled (eq (int .Values.zookeeper.replicaCount) 1) }} |
| - name: "{{ .Release.Name }}-zookeeper-pvc-data" |
| persistentVolumeClaim: |
| claimName: "{{ .Release.Name }}-zookeeper-pvc-data" |
| - name: "{{ .Release.Name }}-zookeeper-pvc-datalog" |
| persistentVolumeClaim: |
| claimName: "{{ .Release.Name }}-zookeeper-pvc-datalog" |
| {{- end }} |
| {{ include "openwhisk.docker.imagePullSecrets" . | indent 6 }} |
| containers: |
| - name: zookeeper |
| image: "{{- .Values.docker.registry.name -}}{{- .Values.zookeeper.imageName -}}:{{- .Values.zookeeper.imageTag -}}" |
| imagePullPolicy: {{ .Values.zookeeper.imagePullPolicy | quote }} |
| command: ["/bin/bash", "-c", "hostname -s | cut -d'-' -f3 > {{ .Values.zookeeper.config.dataDir }}/myid; cat {{ .Values.zookeeper.config.dataDir }}/myid; cat /conf/zoo.cfg; zkServer.sh start-foreground"] |
| ports: |
| - name: zookeeper |
| containerPort: {{ .Values.zookeeper.port }} |
| - name: server |
| containerPort: {{ .Values.zookeeper.serverPort }} |
| - name: leader-election |
| containerPort: {{ .Values.zookeeper.leaderElectionPort }} |
| |
| livenessProbe: |
| tcpSocket: |
| port: {{ .Values.zookeeper.port }} |
| initialDelaySeconds: {{ .Values.probes.zookeeper.livenessProbe.initialDelaySeconds }} |
| periodSeconds: {{ .Values.probes.zookeeper.livenessProbe.periodSeconds }} |
| timeoutSeconds: {{ .Values.probes.zookeeper.livenessProbe.timeoutSeconds }} |
| readinessProbe: |
| exec: |
| command: |
| - /bin/bash |
| - -c |
| - "echo ruok | nc -w 1 localhost:{{ .Values.zookeeper.port }} | grep imok" |
| initialDelaySeconds: {{ .Values.probes.zookeeper.readinessProbe.initialDelaySeconds }} |
| periodSeconds: {{ .Values.probes.zookeeper.readinessProbe.periodSeconds }} |
| timeoutSeconds: {{ .Values.probes.zookeeper.readinessProbe.timeoutSeconds }} |
| volumeMounts: |
| - mountPath: /conf |
| name: zk-config |
| {{- if .Values.k8s.persistence.enabled }} |
| - mountPath: {{ .Values.zookeeper.config.dataDir }} |
| name: "{{ .Release.Name }}-zookeeper-pvc-data" |
| - mountPath: {{ .Values.zookeeper.config.dataLogDir }} |
| name: "{{ .Release.Name }}-zookeeper-pvc-datalog" |
| {{- end }} |
| |
| {{/* PVCs created by volumeClaimTemplates must be manually removed; only create them if we absolutely need them */}} |
| {{- if and .Values.k8s.persistence.enabled (gt (int .Values.zookeeper.replicaCount) 1) }} |
| volumeClaimTemplates: |
| - metadata: |
| name: "{{ .Release.Name }}-zookeeper-pvc-data" |
| spec: |
| {{- if not .Values.k8s.persistence.hasDefaultStorageClass }} |
| storageClassName: {{ .Values.k8s.persistence.explicitStorageClass }} |
| {{- end }} |
| accessModes: |
| - ReadWriteOnce |
| resources: |
| requests: |
| storage: {{ .Values.zookeeper.persistence.size }} |
| - metadata: |
| name: "{{ .Release.Name }}-zookeeper-pvc-datalog" |
| spec: |
| {{- if not .Values.k8s.persistence.hasDefaultStorageClass }} |
| storageClassName: {{ .Values.k8s.persistence.explicitStorageClass }} |
| {{- end }} |
| accessModes: |
| - ReadWriteOnce |
| resources: |
| requests: |
| storage: {{ .Values.zookeeper.persistence.size }} |
| {{- end }} |
| {{- end }} |