Skip to content

Commit

Permalink
kafka: prefix cluster_id with "redpanda."
Browse files Browse the repository at this point in the history
...and report a dummy "redpanda.initializing" cluster
ID if the cluster_id isn't set yet (it should eventually
be set automatically)
  • Loading branch information
jcsp committed May 10, 2022
1 parent 0a8d377 commit 6592316
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/v/kafka/server/handlers/metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,15 @@ ss::future<response_ptr> metadata_handler::handle(
}
}

reply.data.cluster_id = config::shard_local_cfg().cluster_id;
const auto cluster_id = config::shard_local_cfg().cluster_id();
if (cluster_id.has_value()) {
reply.data.cluster_id = ssx::sformat("redpanda.{}", cluster_id.value());
} else {
// Include a "redpanda." cluster ID even if we didn't initialize
// cluster_id yet, so that callers can identify which Kafka
// implementation they're talking to.
reply.data.cluster_id = "redpanda.initializing";
}

auto leader_id = ctx.metadata_cache().get_controller_leader_id();
reply.data.controller_id = leader_id.value_or(model::node_id(-1));
Expand Down

0 comments on commit 6592316

Please sign in to comment.