[bitnami/zookeeper] Made dataLogDir customizable. (#2994)

* Made dataLogDir customizable.

* Added a property to values.yaml and values-production.yaml to set the dataLogDir zookeeper property.
* Updated the statefulset to allow setting the dataLogDir via an ENV and to handle the persistent storage if set.

* Bumped docker image tag
This commit is contained in:
jonathan-m-foley
2020-07-14 03:59:21 -04:00
committed by GitHub
parent a45f56d5a9
commit 8071c0c63e
5 changed files with 76 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
apiVersion: v1
name: zookeeper
version: 5.17.3
version: 5.18.0
appVersion: 3.6.1
description: A centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services for distributed applications.
keywords:

View File

@@ -126,6 +126,9 @@ The following tables lists the configurable parameters of the ZooKeeper chart an
| `persistence.accessModes` | PVC Access Mode for ZooKeeper volume | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request for ZooKeeper volume | `8Gi` |
| `persistence.annotations` | Annotations for the PVC | `{}` |
| `dataLogDir` | Data log directory. Specifying this option will direct zookeeper to write the transaction log to the dataLogDir rather than the dataDir. This allows a dedicated log device to be used, and helps avoid competition between logging and snaphots. Setting this value to an empty string will result in the log being written to the data directory (i.e. Zookeeper's default behavior). | `/bitnami/zookeeper/dataLog` |
| `persistence.dataLogDir.size` | PVC Storage Request for ZooKeeper's dataLogDir volume (if set via .Values.dataLogDir) | `8Gi` |
| `persistence.dataLogDir.existingClaim` | Provide an existing `PersistentVolumeClaim` for Zookeeper's dataLogDir ((if set via .Values.dataLogDir), the value is evaluated as a template | `nil` |
| `podLabels` | Labels for ZooKeeper pod | `{}` |
| `podAnnotations` | Annotations for ZooKeeper pod | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |

View File

@@ -61,7 +61,15 @@ spec:
- name: volume-permissions
image: {{ template "zookeeper.volumePermissions.image" . }}
imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "/bitnami/zookeeper"]
command:
- chown
args:
- -R
- {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}
- /bitnami/zookeeper
{{- if .Values.dataLogDir }}
- {{ .Values.dataLogDir }}
{{- end }}
securityContext:
runAsUser: 0
{{- if .Values.volumePermissions.resources }}
@@ -70,6 +78,10 @@ spec:
volumeMounts:
- name: data
mountPath: /bitnami/zookeeper
{{- if .Values.dataLogDir }}
- name: data-log
mountPath: {{ .Values.dataLogDir }}
{{- end }}
{{- end }}
containers:
- name: zookeeper
@@ -97,6 +109,8 @@ spec:
resources: {{- toYaml .Values.resources | nindent 12 }}
{{- end }}
env:
- name: ZOO_DATA_LOG_DIR
value: {{ .Values.dataLogDir | quote }}
- name: ZOO_PORT_NUMBER
value: {{ .Values.service.port | quote }}
- name: ZOO_TICK_TIME
@@ -240,6 +254,10 @@ spec:
volumeMounts:
- name: data
mountPath: /bitnami/zookeeper
{{- if .Values.dataLogDir }}
- name: data-log
mountPath: {{ .Values.dataLogDir }}
{{- end }}
{{- if .Values.config }}
- name: config
mountPath: /opt/bitnami/zookeeper/conf/zoo.cfg
@@ -262,11 +280,20 @@ spec:
- name: data
emptyDir: {}
{{- end }}
{{- if and .Values.persistence.enabled .Values.persistence.dataLogDir.existingClaim }}
- name: data-log
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.persistence.dataLogDir.existingClaim .) }}
{{- else if and ( not .Values.persistence.enabled ) .Values.dataLogDir }}
- name: data-log
emptyDir: {}
{{- end }}
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim )}}
{{- if and .Values.persistence.enabled (not (and .Values.persistence.existingClaim .Values.persistence.dataLogDir.existingClaim) )}}
volumeClaimTemplates:
{{- if not .Values.persistence.existingClaim }}
- metadata:
name: data
annotations:
@@ -282,4 +309,22 @@ spec:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- include "zookeeper.storageClass" . | nindent 8 }}
{{- end }}
{{- if and (not .Values.persistence.dataLogDir.existingClaim) .Values.dataLogDir }}
- metadata:
name: data-log
annotations:
{{- range $key, $value := .Values.persistence.annotations }}
{{ $key }}: {{ $value }}
{{- end }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.dataLogDir.size | quote }}
{{- include "zookeeper.storageClass" . | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -14,7 +14,7 @@
image:
registry: docker.io
repository: bitnami/zookeeper
tag: 3.6.1-debian-10-r74
tag: 3.6.1-debian-10-r77
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
@@ -167,6 +167,10 @@ heapSize: 1024
##
logLevel: ERROR
## Data log directory. Specifying this option will direct zookeeper to write the transaction log to the dataLogDir rather than the dataDir.
## This allows a dedicated log device to be used, and helps avoid competition between logging and snaphots.
dataLogDir: /bitnami/zookeeper/dataLog
## Default JVMFLAGS for the ZooKeeper process
##
# jvmFlags:
@@ -241,6 +245,13 @@ persistence:
- ReadWriteOnce
size: 8Gi
annotations: {}
dataLogDir:
size: 8Gi
## A manually managed Persistent Volume and Claim
## If defined, PVC must be created manually before volume will be bound
## The value is evaluated as a template
##
# existingClaim:
## Node labels for pod assignment
## Ref: https://kubernetes.io/docs/user-guide/node-selection/

View File

@@ -14,7 +14,7 @@
image:
registry: docker.io
repository: bitnami/zookeeper
tag: 3.6.1-debian-10-r74
tag: 3.6.1-debian-10-r77
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
@@ -174,6 +174,10 @@ heapSize: 1024
##
logLevel: ERROR
## Data log directory. Specifying this option will direct zookeeper to write the transaction log to the dataLogDir rather than the dataDir.
## This allows a dedicated log device to be used, and helps avoid competition between logging and snaphots.
dataLogDir: /bitnami/zookeeper/dataLog
## Default JVMFLAGS for the ZooKeeper process
##
# jvmFlags:
@@ -248,6 +252,14 @@ persistence:
- ReadWriteOnce
size: 8Gi
annotations: {}
dataLogDir:
size: 8Gi
## A manually managed Persistent Volume and Claim
## If defined, PVC must be created manually before volume will be bound
## The value is evaluated as a template
##
# existingClaim:
## Node labels for pod assignment
## Ref: https://kubernetes.io/docs/user-guide/node-selection/