Partition reassignment of Kafka using Helm charts

1/14/2019

I wish to reassign partitions in Kafka on scale in/scale out of nodes deployed on Kubernetes using helm charts.

I have written a python script which can perform the necessary actions. However, I wish to do the same using Helm charts itself without having to involve any additional scripts.

I was checking out the Helm charts for Kafka in the Helm Github repo.

I came across the configmap-config file inside their templates. I am very new to Helm. Hence, having difficulty in interpreting the YAML file.

Line numbers 39 and 40 have the following commands which is precisely what I am executing using my python scripts.

kafka-reassign-partitions --zookeeper {{ $zk }} --reassignment-json-file {{ $topic.name }}-increase-replication-factor.json --execute
kafka-reassign-partitions --zookeeper {{ $zk }} --reassignment-json-file {{ $topic.name }}-increase-replication-factor.json --verify

Can you please explain how can these lines be triggered using Helm charts itself without having to run any script.

-- amankedia
apache-kafka
kubernetes
kubernetes-helm

1 Answer

1/14/2019

The token $ indicates a variable. So, {{ $zk }} means that this variable were defined before, in this case at line 2. And this info is defined at section zookeeper at line 392 from values.yaml file.

The same thing for {{ topic.name }}. You should define this info in values.yaml too.

Then, you can install using Helm.

-- Mauro Baraldi
Source: StackOverflow