| # Licensed to the Apache Software Foundation (ASF) under one or more contributor |
| # license agreements; and to You under the Apache License, Version 2.0. |
| |
| {{- 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: 5 |
| periodSeconds: 10 |
| # Disabled: See issue https://github.com/apache/incubator-openwhisk-deploy-kube/issues/469 |
| # readinessProbe: |
| # exec: |
| # command: |
| # - /bin/bash |
| # - -c |
| # - "echo ruok | nc -w 1 localhost:{{ .Values.zookeeper.port }} | grep imok" |
| # initialDelaySeconds: 5 |
| # periodSeconds: 10 |
| 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 }} |