Skip to content

AKCORE-915 : Add on-prem support for kafka share-group commands (list, describe,consumer list)#3297

Open
Devarsh Patel (Devarsh010) wants to merge 2 commits intomainfrom
AKCORE-915-1
Open

AKCORE-915 : Add on-prem support for kafka share-group commands (list, describe,consumer list)#3297
Devarsh Patel (Devarsh010) wants to merge 2 commits intomainfrom
AKCORE-915-1

Conversation

@Devarsh010
Copy link
Copy Markdown
Member

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

  • I have successfully built and used a custom CLI binary, without linter issues from this PR.
  • I have clearly specified in the What section below whether this PR applies to Confluent Cloud, Confluent Platform, or both.
  • I have verified this PR in Confluent Cloud pre-prod or production environment, if applicable.
  • I have verified this PR in Confluent Platform on-premises environment, if applicable.
  • I have attached manual CLI verification results or screenshots in the Test & Review section below.
  • I have added appropriate CLI integration or unit tests for any new or updated commands and functionality.
  • I confirm that this PR introduces no breaking changes or backward compatibility issues.
  • I have indicated the potential customer impact if something goes wrong in the Blast Radius section below.
  • I have put checkmarks below confirming that the feature associated with this PR is enabled in:
    • Confluent Cloud prod
    • Confluent Cloud stag
    • Confluent Platform
    • Check this box if the feature is enabled for certain organizations only

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, and consumer list commands, following the same cloud/on-prem routing pattern used by consumer group commands.

Key changes:

  • Refactored newShareGroupCommand to accept *config.Config and branch on cfg.IsCloudLogin(), matching the pattern in command_consumer.go.
  • Added on-prem command implementations (list, describe, consumer list) using initKafkaRest() and the ShareGroupV3Api from the kafka-rest-sdk-go.
  • Updated kafka-rest-sdk-go dependency to include the new ShareGroupV3Api for on-prem.
  • Added integration tests and help golden files for all on-prem commands.

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 and kafkarest.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

  • Built and verified the CLI binary locally (make build).
    • Ran go vet ./internal/kafka/... with no issues.
    • Manually tested all three on-prem commands against a local Kafka cluster with REST Proxy:
      • confluent kafka share-group list --url http://localhost:8090/kafka --no-authentication
      • confluent kafka share-group describe <group> --url http://localhost:8090/kafka --no-authentication
      • confluent kafka share-group consumer list --group <group> --url http://localhost:8090/kafka --no-authentication
    • Added integration tests for all on-prem commands (list, describe, consumer list) with error cases.
    • Added 5 help golden files for on-prem and updated kafka/help-onprem.golden.
    • All tests pass: TestCLI/TestKafkaShareGroup, TestCLI/TestKafkaShareGroupConsumer, TestCLI/TestHelp.

Copilot AI review requested due to automatic review settings March 27, 2026 05:01
@Devarsh010 Devarsh Patel (Devarsh010) requested a review from a team as a code owner March 27, 2026 05:01
@confluent-cla-assistant
Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-group root command to branch on cfg.IsCloudLogin() and register either Cloud or on-prem subcommands.
  • Implements on-prem share-group list, share-group describe, and share-group consumer list via initKafkaRest() + ShareGroupV3Api.
  • Adds on-prem integration tests and help/output golden fixtures; updates kafka on-prem help to include share-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.

Comment on lines +57 to +71
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
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)).

Copilot uses AI. Check for mistakes.
@sonarqube-confluent
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants