[incubator/zookeeper] Makes persistence fully configurable (#3720)

* Makes zookeeper persistence fully configurable

* Cleans up docs

* Cleans up docs

* Uses volume templates to support scaling

* Cleans up docs

* Cleans up docs

* Follows best practices for defining storageClassName
This commit is contained in:
Federico Nusymowicz
2018-02-27 13:10:46 -08:00
committed by k8s-ci-robot
parent ec0d131fcf
commit cb8da6f36b
4 changed files with 41 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: zookeeper
home: https://zookeeper.apache.org/
version: 0.4.7
version: 0.5.0
description: Centralized service for maintaining configuration information, naming,
providing distributed synchronization, and providing group services.
icon: https://zookeeper.apache.org/images/zookeeper_small.gif
+7 -2
View File
@@ -71,8 +71,13 @@ The configuration parameters in this section control the resources requested and
| `resources.requests.cpu` | The amount of CPU to request. As ZooKeeper is not very CPU intensive, `2` is a good choice to start with for a production deployment. | `500m` |
| `heap` | The amount of JVM heap that the ZooKeeper servers will use. As ZooKeeper stores all of its data in memory, this value should reflect the size of your working set. The JVM -Xms/-Xmx format is used. |`2G` |
| `resources.requests.memory` | The amount of memory to request. This value should be at least 2 GiB larger than `heap` to avoid swapping. You may want to use `1.5 * heap` for values larger than 2GiB. The Kubernetes format is used. |`2Gi` |
| `storage` | The amount of storage to request. Even though ZooKeeper keeps is working set in memory, it logs all transactions, and periodically snapshots, to storage media. The amount of storage required will vary with your workload, working memory size, and log and snapshot retention policy. Note that, on some cloud providers selecting a small volume size will result is sub-par I/O performance. 250 GiB is a good place to start for production workloads. | `50Gi`|
| `storageClass` | The storage class of the storage allocated for the ensemble. If this value is present, it will add an annotation asking the PV Provisioner for that storage class. | `default` |
### Persistence
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `persistence.enabled` | Whether to create a PVC. If `false`, an `emptyDir` on the host will be used. | `true` |
| `persistence.size` | Size of PVC that gets created. For production deployments this value should likely be much larger. | `5Gi` |
| `persistence.storageClass` | Valid options: `nil`, `"-"`, or storage class name. See values.yaml for details. | `nil` |
### Network
These parameters control the network ports on which the ensemble communicates.
+14 -3
View File
@@ -87,11 +87,17 @@ spec:
- name: datadir
mountPath: /var/lib/zookeeper
subPath: data
{{ if not .Values.persistence.enabled }}
volumes:
- name: datadir
emptyDir: {}
{{- end }}
{{- if eq .Values.security.enabled true }}
securityContext:
runAsUser: {{ .Values.security.runAsUser }}
fsGroup: {{ .Values.security.fsGroup }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: datadir
@@ -99,7 +105,12 @@ spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: {{ .Values.storage }}
{{- if .Values.storageClass }}
storageClassName: {{ .Values.storageClass | quote }}
storage: {{ .Values.persistence.size }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
+19 -2
View File
@@ -14,8 +14,6 @@ resources:
cpu: 1
memory: 4Gi
heap: "2G"
storage: "50Gi"
# storageClass: default
serverPort: 2888
leaderElectionPort: 3888
clientPort: 2181
@@ -56,3 +54,22 @@ affinity: {}
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
##
nodeSelector: {}
## Persistence configuration. Specify if and how to persist data to a persistent volume.
##
persistence:
enabled: true
## The size of the PersistentVolume to allocate to each Zookeeper Pod in the StatefulSet. For
## production servers this number should likely be much larger.
##
size: "5Gi"
## Zookeeper data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: