Skip to content

Commit 432190b

Browse files
robobarioppatierno
authored andcommitted
Extract consumer client.rack from /opt/strimzi/init/rack.id if present (#659)
Extract consumer client.rack from ${STRIMZI_HOME}/init/rack.id if present Why: To support rack awareness the strimzi kafka operator will mount in a file containing the rack.id, this can be appended to the consumer configuration if it is present Signed-off-by: Robert Young <[email protected]> Signed-off-by: Robert Young <[email protected]> Co-authored-by: Robert Young <[email protected]>
1 parent ff2ba23 commit 432190b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

bin/docker/kafka_bridge_config_generator.sh

+11
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@ EOF
117117
)
118118
done
119119

120+
# Get broker rack if it's enabled from the file $KAFKA_HOME/init/rack.id (if it exists). This file is generated by the
121+
# init-container used when rack awareness is enabled.
122+
if [ -e "$STRIMZI_HOME/init/rack.id" ]; then
123+
STRIMZI_RACK_ID=$(cat "$STRIMZI_HOME/init/rack.id")
124+
CONSUMER_PROPERTIES=$(cat <<EOF
125+
$CONSUMER_PROPERTIES
126+
kafka.consumer.client.rack=${STRIMZI_RACK_ID}
127+
EOF
128+
)
129+
fi
130+
120131
ADMIN_CLIENT_PROPERTIES="#Apache Kafka AdminClient"
121132
for i in $KAFKA_BRIDGE_ADMIN_CLIENT_CONFIG; do
122133
key="kafka.admin.$(echo $i | cut -d'=' -f1)"

0 commit comments

Comments
 (0)