Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change addressing DescribeCluster v0 compatibility.
No open issues 🎉
What changed in this PR
Fixes #3203 by allowing KafkaAdminClient.describe_cluster() to handle DescribeCluster v0 responses, which omit endpoint_type. This restores compatibility with Kafka 2.8–3.6 and compatible v0-only brokers.
Changes:
- Safely remove
endpoint_typeonly when present in the response. - Add a regression test using a mock Kafka 3.6 broker to verify successful cluster metadata retrieval.
| File | Description |
|---|---|
test/admin/test_admin_cluster.py |
Adds regression coverage for DescribeCluster v0 responses. |
kafka/admin/_cluster.py |
Defaults the endpoint_type removal to None, preventing a KeyError. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3203. Since #3053,
KafkaAdminClient.describe_cluster()popsendpoint_typeunconditionally from the DescribeCluster response.endpoint_typewas only added to the response schema in v1 (KIP-919), so against brokers that support DescribeCluster at v0 only — Apache Kafka 2.8 through 3.6, and Kafka-compatible brokers implementing only v0 — the pop raisesKeyError: 'endpoint_type'.The pop now defaults to
Nonewhen the key is absent, matching howthrottle_time_msis already handled on the line below.Tests
test_describe_cluster_v0_response: parametrize the mock broker at (3, 6), which negotiates DescribeCluster v0 (noendpoint_typein the response). Fails on current code with the reportedKeyError, passes with this change.test/admin/module: 204 passed. Full unit suite: 2730 passed, 1 pre-existing environment failure (test_crc32c[None], missing crc32c library — fails identically on the clean tree), 30 skipped.Disclosure: this patch was prepared with AI assistance and reviewed/tested by me.