From f4eb7172411355ba3ebf164e05ecaa37dbb2f5c2 Mon Sep 17 00:00:00 2001 From: antonmatsiuk Date: Mon, 14 Dec 2020 17:29:29 +0100 Subject: [PATCH] bitnami/kafka add minBrokerId variable (#4683) --- bitnami/kafka/Chart.yaml | 2 +- bitnami/kafka/README.md | 61 ++++++++++--------- .../kafka/templates/scripts-configmap.yaml | 8 ++- bitnami/kafka/values-production.yaml | 6 ++ bitnami/kafka/values.yaml | 6 ++ 5 files changed, 50 insertions(+), 33 deletions(-) diff --git a/bitnami/kafka/Chart.yaml b/bitnami/kafka/Chart.yaml index 6116f3fa0..ff93b6898 100644 --- a/bitnami/kafka/Chart.yaml +++ b/bitnami/kafka/Chart.yaml @@ -29,4 +29,4 @@ name: kafka sources: - https://github.com/bitnami/bitnami-docker-kafka - https://kafka.apache.org/ -version: 12.3.2 +version: 12.4.0 diff --git a/bitnami/kafka/README.md b/bitnami/kafka/README.md index 08d932e02..e07d1b799 100644 --- a/bitnami/kafka/README.md +++ b/bitnami/kafka/README.md @@ -130,36 +130,37 @@ The following tables lists the configurable parameters of the Kafka chart and th ### Statefulset parameters -| Parameter | Description | Default | -|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------| -| `replicaCount` | Number of Kafka nodes | `1` | -| `updateStrategy` | Update strategy for the stateful set | `RollingUpdate` | -| `rollingUpdatePartition` | Partition update strategy | `nil` | -| `podLabels` | Kafka pod labels | `{}` (evaluated as a template) | -| `podAnnotations` | Kafka Pod annotations | `{}` (evaluated as a template) | -| `priorityClassName` | Name of the existing priority class to be used by kafka pods | `""` | -| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | -| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` | -| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | -| `nodeAffinityPreset.key` | Node label key to match Ignored if `affinity` is set. | `""` | -| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set. | `[]` | -| `affinity` | Affinity for pod assignment | `{}` (evaluated as a template) | -| `nodeSelector` | Node labels for pod assignment | `{}` (evaluated as a template) | -| `tolerations` | Tolerations for pod assignment | `[]` (evaluated as a template) | -| `podSecurityContext` | Kafka pods' Security Context | `{}` | -| `containerSecurityContext` | Kafka containers' Security Context | `{}` | -| `resources.limits` | The resources limits for Kafka containers | `{}` | -| `resources.requests` | The requested resources for Kafka containers | `{}` | -| `livenessProbe` | Liveness probe configuration for Kafka | `Check values.yaml file` | -| `readinessProbe` | Readiness probe configuration for Kafka | `Check values.yaml file` | -| `customLivenessProbe` | Custom Liveness probe configuration for Kafka | `{}` | -| `customReadinessProbe` | Custom Readiness probe configuration for Kafka | `{}` | -| `pdb.create` | Enable/disable a Pod Disruption Budget creation | `false` | -| `pdb.minAvailable` | Minimum number/percentage of pods that should remain scheduled | `nil` | -| `pdb.maxUnavailable` | Maximum number/percentage of pods that may be made unavailable | `1` | -| `command` | Override kafka container command | `['/scripts/setup.sh']` (evaluated as a template) | -| `args` | Override kafka container arguments | `[]` (evaluated as a template) | -| `sidecars` | Attach additional sidecar containers to the Kafka pod | `{}` | +| Parameter | Description | Default | +|:--------------------------------------|:------------------------------------------------------------------------------------------|:---------------------------------------------------| +| `replicaCount` | Number of Kafka nodes | `1` | +| `minBrokerId` | Minimal broker.id value, nodes increment their `broker.id` respectively | `0` | +| `updateStrategy` | Update strategy for the stateful set | `RollingUpdate` | +| `rollingUpdatePartition` | Partition update strategy | `nil` | +| `podLabels` | Kafka pod labels | `{}` (evaluated as a template) | +| `podAnnotations` | Kafka Pod annotations | `{}` (evaluated as a template) | +| `priorityClassName` | Name of the existing priority class to be used by kafka pods | `""` | +| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` | +| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `nodeAffinityPreset.key` | Node label key to match Ignored if `affinity` is set. | `""` | +| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set. | `[]` | +| `affinity` | Affinity for pod assignment | `{}` (evaluated as a template) | +| `nodeSelector` | Node labels for pod assignment | `{}` (evaluated as a template) | +| `tolerations` | Tolerations for pod assignment | `[]` (evaluated as a template) | +| `podSecurityContext` | Kafka pods' Security Context | `{}` | +| `containerSecurityContext` | Kafka containers' Security Context | `{}` | +| `resources.limits` | The resources limits for Kafka containers | `{}` | +| `resources.requests` | The requested resources for Kafka containers | `{}` | +| `livenessProbe` | Liveness probe configuration for Kafka | `Check values.yaml file` | +| `readinessProbe` | Readiness probe configuration for Kafka | `Check values.yaml file` | +| `customLivenessProbe` | Custom Liveness probe configuration for Kafka | `{}` | +| `customReadinessProbe` | Custom Readiness probe configuration for Kafka | `{}` | +| `pdb.create` | Enable/disable a Pod Disruption Budget creation | `false` | +| `pdb.minAvailable` | Minimum number/percentage of pods that should remain scheduled | `nil` | +| `pdb.maxUnavailable` | Maximum number/percentage of pods that may be made unavailable | `1` | +| `command` | Override kafka container command | `['/scripts/setup.sh']` (evaluated as a template) | +| `args` | Override kafka container arguments | `[]` (evaluated as a template) | +| `sidecars` | Attach additional sidecar containers to the Kafka pod | `{}` | ### Exposure parameters diff --git a/bitnami/kafka/templates/scripts-configmap.yaml b/bitnami/kafka/templates/scripts-configmap.yaml index 12f33c6bb..0b4f77dfe 100644 --- a/bitnami/kafka/templates/scripts-configmap.yaml +++ b/bitnami/kafka/templates/scripts-configmap.yaml @@ -71,8 +71,12 @@ data: setup.sh: |- #!/bin/bash - ID="${MY_POD_NAME#"{{ $fullname }}-"}" - export KAFKA_CFG_BROKER_ID="$ID" + if [[ -f "/bitnami/kafka/data/meta.properties" ]]; then + export KAFKA_CFG_BROKER_ID="$(grep "broker.id" /bitnami/kafka/data/meta.properties | awk -F '=' '{print $2}')" + else + ID="${MY_POD_NAME#"{{ $fullname }}-"}" + export KAFKA_CFG_BROKER_ID="$((ID + {{ .Values.minBrokerId }}))" + fi {{- if .Values.externalAccess.enabled }} # Configure external ip and port diff --git a/bitnami/kafka/values-production.yaml b/bitnami/kafka/values-production.yaml index 949499d77..b341e7db7 100644 --- a/bitnami/kafka/values-production.yaml +++ b/bitnami/kafka/values-production.yaml @@ -348,6 +348,12 @@ interBrokerListenerName: INTERNAL ## replicaCount: 3 +## Minimal broker.id value +## Brokers increment their ID starting at this minimal value. +## E.g., with `minBrokerId=100` and 3 nodes, IDs will be 100, 101, 102 for brokers 0, 1, and 2, respectively. +## +minBrokerId: 0 + ## StrategyType, can be set to RollingUpdate or OnDelete by default. ## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets ## diff --git a/bitnami/kafka/values.yaml b/bitnami/kafka/values.yaml index fcfc08a6f..21e901b45 100644 --- a/bitnami/kafka/values.yaml +++ b/bitnami/kafka/values.yaml @@ -348,6 +348,12 @@ interBrokerListenerName: INTERNAL ## replicaCount: 1 +## Minimal broker.id value +## Brokers increment their ID starting at this minimal value. +## E.g., with `minBrokerId=100` and 3 nodes, IDs will be 100, 101, 102 for brokers 0, 1, and 2, respectively. +## +minBrokerId: 0 + ## StrategyType, can be set to RollingUpdate or OnDelete by default. ## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets ##