From e1f9143a565c54d2d9a09838e7e7fc79b9fe83f8 Mon Sep 17 00:00:00 2001 From: Liviu Costea Date: Sat, 16 Mar 2019 12:57:06 +0200 Subject: [PATCH] Manage disruptions when using more than 1 replicas Created a pod distruption budget when replicas is bigger than 1 By default only 1 pod can be unavailable Added additional label so the pdb doesn't select the metrics pod --- bitnami/zookeeper/Chart.yaml | 2 +- bitnami/zookeeper/README.md | 1 + .../templates/poddisruptionbudget.yaml | 20 +++++++++++++++++++ bitnami/zookeeper/values-production.yaml | 8 ++++++++ bitnami/zookeeper/values.yaml | 9 +++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 bitnami/zookeeper/templates/poddisruptionbudget.yaml diff --git a/bitnami/zookeeper/Chart.yaml b/bitnami/zookeeper/Chart.yaml index eb64881286..86fd7e4f28 100644 --- a/bitnami/zookeeper/Chart.yaml +++ b/bitnami/zookeeper/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: zookeeper -version: 1.6.1 +version: 1.7.0 appVersion: 3.4.14 description: A centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services for distributed applications. keywords: diff --git a/bitnami/zookeeper/README.md b/bitnami/zookeeper/README.md index fac4382fac..338887127b 100644 --- a/bitnami/zookeeper/README.md +++ b/bitnami/zookeeper/README.md @@ -56,6 +56,7 @@ The following tables lists the configurable parameters of the Zookeeper chart an | `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | | `image.debug` | Specify if debug values should be set | `false` | | `updateStrategy` | Update strategies | `RollingUpdate` | +| `podDisruptionBudget.maxUnavailable` | Max number of pods down simultaneously | `1` | | `rollingUpdatePartition` | Partition update strategy | `nil` | | `podManagementpolicy` | Pod management policy | `Parallel` | | `replicaCount` | Number of ZooKeeper nodes | `1` | diff --git a/bitnami/zookeeper/templates/poddisruptionbudget.yaml b/bitnami/zookeeper/templates/poddisruptionbudget.yaml new file mode 100644 index 0000000000..9179f25900 --- /dev/null +++ b/bitnami/zookeeper/templates/poddisruptionbudget.yaml @@ -0,0 +1,20 @@ +{{- if gt .Values.replicaCount 1.0 -}} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "zookeeper.fullname" . }} + labels: + app: {{ template "zookeeper.name" . }} + chart: {{ template "zookeeper.chart" . }} + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} + app.kubernetes.io/component: {{ template "zookeeper.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} +spec: + selector: + matchLabels: + app: {{ template "zookeeper.name" . }} + release: {{ .Release.Name | quote }} + app.kubernetes.io/component: {{ template "zookeeper.name" . }} +{{ toYaml .Values.podDisruptionBudget | indent 2 }} +{{- end }} \ No newline at end of file diff --git a/bitnami/zookeeper/values-production.yaml b/bitnami/zookeeper/values-production.yaml index cac559397a..94dcdf000c 100644 --- a/bitnami/zookeeper/values-production.yaml +++ b/bitnami/zookeeper/values-production.yaml @@ -36,6 +36,14 @@ image: ## updateStrategy: RollingUpdate + +## Limits the number of pods of the replicated application that are down simultaneously from voluntary disruptions +## ref: https://kubernetes.io/docs/concepts/workloads/pods/disruptions +## +podDisruptionBudget: + maxUnavailable: 1 + + ## Partition update strategy ## https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions ## diff --git a/bitnami/zookeeper/values.yaml b/bitnami/zookeeper/values.yaml index 350166224c..5e118f353a 100644 --- a/bitnami/zookeeper/values.yaml +++ b/bitnami/zookeeper/values.yaml @@ -36,6 +36,15 @@ image: ## updateStrategy: RollingUpdate + +## Limits the number of pods of the replicated application that are down simultaneously from voluntary disruptions +## The PDB will only be created if replicaCount is greater than 1 +## ref: https://kubernetes.io/docs/concepts/workloads/pods/disruptions +## +podDisruptionBudget: + maxUnavailable: 1 + + ## Partition update strategy ## https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions ##