Create a pod distruption budget when replicas is bigger than 1

By default only 1 pod can be unavailable

Signed-off-by: Liviu Costea <email.lcostea@gmail.com>
This commit is contained in:
Liviu Costea
2019-05-08 17:46:00 +03:00
parent fbba4cf4c0
commit 6a0e5d9519
5 changed files with 38 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
apiVersion: v1
name: kafka
version: 2.0.2
version: 2.1.0
appVersion: 2.2.0
description: Apache Kafka is a distributed streaming platform.
keywords:

View File

@@ -57,6 +57,7 @@ The following tables lists the configurable parameters of the Kafka chart and th
| `image.debug` | Specify if debug values should be set | `false` |
| `updateStrategy` | Update strategy for the stateful set | `RollingUpdate` |
| `rollingUpdatePartition` | Partition update strategy | `nil` |
| `podDisruptionBudget.maxUnavailable` | Max number of pods down simultaneously | `1` |
| `replicaCount` | Number of Kafka nodes | `1` |
| `config` | Configuration file for Kafka | `nil` |
| `allowPlaintextListener` | Allow to use the PLAINTEXT listener | `true` |

View File

@@ -0,0 +1,20 @@
{{- $replicaCount := int .Values.replicaCount }}
{{- if gt $replicaCount 1 }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ template "kafka.fullname" . }}
labels:
app.kubernetes.io/name: {{ template "kafka.name" . }}
helm.sh/chart: {{ template "kafka.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: kafka
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ template "kafka.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: kafka
{{ toYaml .Values.podDisruptionBudget | indent 2 }}
{{- end }}

View File

@@ -41,6 +41,14 @@ updateStrategy: RollingUpdate
##
# rollingUpdatePartition:
## 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
replicaCount: 3
config: |-

View File

@@ -41,6 +41,14 @@ updateStrategy: RollingUpdate
##
# rollingUpdatePartition:
## 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
replicaCount: 1
config: |-