AKCORE-915 : Add on-prem support for kafka share-group commands (list, describe,consumer list)#3297
AKCORE-915 : Add on-prem support for kafka share-group commands (list, describe,consumer list)#3297Devarsh Patel (Devarsh010) wants to merge 2 commits intomainfrom
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Adds Confluent Platform (on-prem) support for existing Kafka Share Group CLI commands by routing kafka share-group subcommands to Kafka REST Proxy when not in Cloud mode.
Changes:
- Refactors
kafka share-grouproot command to branch oncfg.IsCloudLogin()and register either Cloud or on-prem subcommands. - Implements on-prem
share-group list,share-group describe, andshare-group consumer listviainitKafkaRest()+ShareGroupV3Api. - Adds on-prem integration tests and help/output golden fixtures; updates
kafkaon-prem help to includeshare-group.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/kafka_test.go | Adds on-prem integration coverage for share-group list/describe and consumer list. |
| test/fixtures/output/kafka/share-group/list-onprem.golden | Golden output for on-prem share-group list. |
| test/fixtures/output/kafka/share-group/list-help-onprem.golden | Golden help for on-prem share-group list. |
| test/fixtures/output/kafka/share-group/help-onprem.golden | Golden help for on-prem share-group root command. |
| test/fixtures/output/kafka/share-group/describe-help-onprem.golden | Golden help for on-prem share-group describe. |
| test/fixtures/output/kafka/share-group/describe-dne-onprem.golden | Golden error output for describe of non-existent share group (on-prem). |
| test/fixtures/output/kafka/share-group/consumer/list-onprem.golden | Golden output for on-prem share-group consumer list. |
| test/fixtures/output/kafka/share-group/consumer/list-help-onprem.golden | Golden help for on-prem share-group consumer list. |
| test/fixtures/output/kafka/share-group/consumer/list-dne-onprem.golden | Golden error output for consumer list of non-existent share group (on-prem). |
| test/fixtures/output/kafka/share-group/consumer/help-onprem.golden | Golden help for on-prem share-group consumer command group. |
| test/fixtures/output/kafka/help-onprem.golden | Adds share-group entry to the on-prem kafka command help. |
| internal/kafka/command_share_group_list_onprem.go | Implements on-prem share-group list via Kafka REST Proxy ShareGroupV3 API. |
| internal/kafka/command_share_group_describe_onprem.go | Implements on-prem share-group describe and topic subscription extraction. |
| internal/kafka/command_share_group_consumer_onprem.go | Adds on-prem share-group consumer command group. |
| internal/kafka/command_share_group_consumer_list_onprem.go | Implements on-prem share-group consumer list via Kafka REST Proxy ShareGroupV3 API. |
| internal/kafka/command_share_group.go | Refactors share-group command registration to support Cloud vs on-prem branching. |
| internal/kafka/command.go | Updates Kafka root command to pass cfg into newShareGroupCommand. |
| go.mod | Bumps kafka-rest-sdk-go/kafkarestv3 to a newer pseudo-version with ShareGroupV3 support. |
| go.sum | Updates checksums for the bumped kafkarestv3 dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| topicSet := make(map[string]bool) | ||
| for _, tp := range shareGroup.AssignedTopicPartitions { | ||
| topicSet[tp.TopicName] = true | ||
| } | ||
|
|
||
| if len(topicSet) == 0 { | ||
| return []string{} | ||
| } | ||
|
|
||
| topics := make([]string, 0, len(topicSet)) | ||
| for topic := range topicSet { | ||
| topics = append(topics, topic) | ||
| } | ||
|
|
||
| return topics |
There was a problem hiding this comment.
getShareGroupTopicNamesOnPrem builds topics by iterating over a Go map (for topic := range topicSet), which yields a non-deterministic order. This can make describe output unstable (especially for -o json|yaml) and can cause flaky tests/users seeing different ordering. Collect the topic names and sort them before returning (e.g., sort.Strings(topics) or slices.Sort(topics)).
|




Release Notes
New Features
Added Confluent Platform (on-prem) support for Share Group CLI commands:
confluent kafka share-group list– lists all Share Groups.confluent kafka share-group describe <id>– describes a specific Share Group.confluent kafka share-group consumer list --group <id>– lists consumers within a Share Group.Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
This PR extends the existing Kafka Share Group CLI commands to support Confluent Platform (on-prem) environments.
Previously, share group commands were available for Confluent Cloud only. This PR adds on-prem support for
list,describe, andconsumer listcommands, following the same cloud/on-prem routing pattern used by consumer group commands.Key changes:
newShareGroupCommandto accept*config.Configand branch oncfg.IsCloudLogin(), matching the pattern incommand_consumer.go.list,describe,consumer list) usinginitKafkaRest()and theShareGroupV3Apifrom the kafka-rest-sdk-go.ShareGroupV3Apifor on-prem.This update targets Confluent Platform users. Existing Confluent Cloud share group commands are unaffected.
Blast Radius
This PR adds on-prem support to the existing share group CLI commands. The changes are additive — no existing cloud share group commands or any other CLI commands are modified in behavior.
The on-prem share group commands use the same
initKafkaRest()helper andkafkarest.NewError()error handling patterns used by other on-prem commands (consumer groups, topics, etc.), minimizing risk of unexpected behavior.If something goes wrong, only Confluent Platform users attempting to use the new on-prem share group commands (
list,describe,consumer list) would be affected. There is no impact on Confluent Cloud users or any other existing CLI functionality.References
https://confluentinc.atlassian.net/browse/AKCORE-915
Test & Review
make build).go vet ./internal/kafka/...with no issues.confluent kafka share-group list --url http://localhost:8090/kafka --no-authenticationconfluent kafka share-group describe <group> --url http://localhost:8090/kafka --no-authenticationconfluent kafka share-group consumer list --group <group> --url http://localhost:8090/kafka --no-authenticationkafka/help-onprem.golden.TestCLI/TestKafkaShareGroup,TestCLI/TestKafkaShareGroupConsumer,TestCLI/TestHelp.