From 5622f3120a2f5f8ed7bef73ced0c47e7133befc1 Mon Sep 17 00:00:00 2001 From: Guanghua Shu Date: Mon, 16 Mar 2020 02:01:20 -0700 Subject: [PATCH] [bitnami/kafka] Achieve consistent broker ids during cluster restart/rebuild (#2028) * [bitnami/kafka] Connect broker id to MY_POD_NAME Current charts leads to increasing broker ids after each restart/rebuild of cluster when Persistent Volumes (PV) are not deleted during restart/rebuild. This is often the case since PVs are usually used to persistent the log messages. This commit provides a way to have deterministic broker ids after each cluster restart/rebuild. * Remove/comment dead code after connecting broker id with MY_POD_NAME * Bump Chart version to 7.3.5 Co-authored-by: Guanghua Shu --- bitnami/kafka/templates/statefulset.yaml | 6 ++++-- bitnami/kafka/values.yaml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bitnami/kafka/templates/statefulset.yaml b/bitnami/kafka/templates/statefulset.yaml index 61acf41e1d..624f2e5b6b 100644 --- a/bitnami/kafka/templates/statefulset.yaml +++ b/bitnami/kafka/templates/statefulset.yaml @@ -151,8 +151,6 @@ spec: {{- end }} - name: ALLOW_PLAINTEXT_LISTENER value: {{ ternary "yes" "no" (or .Values.auth.enabled .Values.allowPlaintextListener) | quote }} - - name: KAFKA_CFG_BROKER_ID - value: {{ .Values.brokerId | quote }} - name: KAFKA_CFG_DELETE_TOPIC_ENABLE value: {{ .Values.deleteTopicEnable | quote }} - name: KAFKA_HEAP_OPTS @@ -206,6 +204,10 @@ spec: {{- if .Values.extraEnvVars }} {{ include "kafka.tplValue" ( dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} {{- end }} + command: ["/bin/bash", "-c"] + args: + - export KAFKA_CFG_BROKER_ID=${MY_POD_NAME##*-}; + exec /entrypoint.sh /run.sh; ports: - name: kafka containerPort: {{ .Values.service.port }} diff --git a/bitnami/kafka/values.yaml b/bitnami/kafka/values.yaml index 9cb635f9b5..781ee0c13e 100644 --- a/bitnami/kafka/values.yaml +++ b/bitnami/kafka/values.yaml @@ -119,7 +119,7 @@ allowPlaintextListener: true # interBrokerListenerName: ## ID of the Kafka node. -brokerId: -1 +# brokerId: -1 ## Switch to enable topic deletion or not. deleteTopicEnable: false