Add --kafka-cluster flag to usm connect register - #3434
Add --kafka-cluster flag to usm connect register#3434Arman Garg (FlamedHunter) wants to merge 2 commits into
--kafka-cluster flag to usm connect register#3434Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Adds support for registering a USM Connect cluster using a new --kafka-cluster flag (in addition to the existing --confluent-platform-kafka-cluster), including updated help text and integration fixtures.
Changes:
- Add
--kafka-clusterflag tousm connect register, making the two Kafka cluster flags mutually exclusive and requiring one of them. - Introduce a “hybrid” output shape for the
--kafka-clusterflow. - Update integration tests and golden outputs to reflect the new flag behavior and validation errors.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
internal/unified-stream-manager/command_connect_register.go |
Adds the new flag, updates examples, and adjusts flag validation/registration flow. |
internal/unified-stream-manager/command_connect.go |
Adds a new output struct + printer used by the --kafka-cluster registration path. |
test/usm_test.go |
Extends integration test coverage for new flag validation; currently includes commented-out success-path cases. |
test/fixtures/output/unified-stream-manager/connect/register-help.golden |
Updates help output to include the new flag and example. |
test/fixtures/output/unified-stream-manager/connect/create-fail-paired-flag-missing.golden |
Updates usage/help output shown on paired-flag validation error. |
test/fixtures/output/unified-stream-manager/connect/create-fail-mutually-exclusive-kafka-flags.golden |
Adds fixture for mutually-exclusive Kafka flag error. |
test/fixtures/output/unified-stream-manager/connect/create-fail-missing-kafka-flag.golden |
Adds fixture for “one required” Kafka flag validation error. |
test/fixtures/output/unified-stream-manager/connect/create-cp-kafka.golden |
Adds fixture for the --kafka-cluster success-path output currently exercised by tests. |
Suppressed comments (1)
internal/unified-stream-manager/command_connect_register.go:69
- The --kafka-cluster path still flows through the on-prem→cloud Kafka ID mapping and the "not found" logging. For cloud IDs like "lkc-...", this will always miss the map, log a misleading error on success, and can even fail early if ListUsmKafkaClusters requires permissions (even though the mapping is irrelevant for --kafka-cluster).
if cmd.Flags().Changed("kafka-cluster") {
kafkaClusterId, err = cmd.Flags().GetString("kafka-cluster")
if err != nil {
return err
}
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| cmd.Flags().String("confluent-platform-kafka-cluster", "", "The ID of the metadata Kafka cluster for the Connect Cluster.") | ||
| cmd.Flags().String("kafka-cluster", "", `The ID of the metadata Kafka cluster for the Connect Cluster.`) |
| //{args: "usm connect register connect-group-xyz123 --kafka-cluster lkc-abc123 --cloud aws --region us-east-1", fixture: "unified-stream-manager/connect/create-cloud-kafka.golden"}, | ||
| //{args: "usm connect register connect-group-xyz123 --kafka-cluster lkc-abc123 --cloud aws --region us-east-1 -o json", fixture: "unified-stream-manager/connect/create-cloud-kafka-json.golden"}, | ||
| {args: "usm connect register connect-group-xyz123 --kafka-cluster 4k0R9d1GTS5tI9f4Y2xZ0Q --cloud aws --region us-east-1", fixture: "unified-stream-manager/connect/create-cp-kafka.golden"}, | ||
| {args: "usm connect register connect-group-xyz123 --confluent-platform-kafka-cluster 4k0R9d1GTS5tI9f4Y2xZ0Q --kafka-cluster lkc-abc123 --cloud aws --region us-east-1", fixture: "unified-stream-manager/connect/create-fail-mutually-exclusive-kafka-flags.golden", exitCode: 1}, |
|
| type connectHybridOut struct { | ||
| Id string `human:"ID" serialized:"id"` | ||
| ConnectCluster string `human:"Connect Cluster" serialized:"connect_cluster"` | ||
| USMKafkaClusterId string `human:"USM Kafka Cluster ID" serialized:"usm_kafka_cluster_id"` |
There was a problem hiding this comment.
Can we check with the cli team is it is okay to remove this flag altogether?
or is the recommendation to deprecate this first?




Release Notes
Breaking Changes
New Features
--kafka-clusterflag toconfluent unified-stream-manager connect register, accepting either a Confluent Platform Kafka cluster ID or a Confluent Cloud Kafka cluster ID (lkc-...), as an alternative to--confluent-platform-kafka-cluster.Bug Fixes
Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
--kafka-clusterflag toconfluent unified-stream-manager connect register, accepting either a Confluent Platform Kafka cluster ID or a Confluent Cloud Kafka cluster ID (lkc-...), as an alternative to--confluent-platform-kafka-cluster.--confluent-platform-kafka-cluster's behavior and response shape are unchanged.--kafka-clusterregistrations print a new, simplified response (a single "Kafka Cluster" field) containing the value passed to the flag as-is. TheCP-to-USMresolution lookup still runs internally but its result isn't surfaced in this response.kafka_cluster_idfield on the existingusm/v1/connect-clusterscreate request.Blast Radius
References
Test & Review
For cloud Kafka cluster (registered on USM as hybrid)
Existing behaviour
Using new flag (
kafka-cluster)For cloud Kafka cluster
Existing behaviour
Using new flag (
kafka-cluster)For on-prem Kafka Cluster
Existing behaviour
Using new flag (
kafka-cluster)