[SETU-2677] Add USM cluster-level RBAC role-binding scopes to CLI#3376
[SETU-2677] Add USM cluster-level RBAC role-binding scopes to CLI#3376Varun PV (varunpv) wants to merge 3 commits into
Conversation
Support creating, listing, and deleting role bindings at USM Kafka and USM Connect cluster scope (cloud login), backing cc-role-definitions #444 (Design C: independent usm-kafka-cluster / usm-connect-cluster binding scopes as siblings of cloud-cluster under environment). - Add --usm-kafka-cluster and --usm-connect-cluster scope flags to `iam rbac role-binding` create/list/delete. - Construct CRN segments /usm-kafka-cluster=<id> and /usm-connect-cluster=<id> (full scope name, not abbreviated). - Require --environment plus the matching USM cluster flag for the USM cluster-scoped roles (Usm{Kafka,Connect}{ClusterAdmin,Operator,MetricsViewer}). - Render USM scopes cleanly in list output (Cluster Type / Logical Cluster). - Unit tests for CRN construction and scope validation, integration tests, and golden files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Adds CLI support and tests for USM Kafka and USM Connect cluster-level RBAC role-binding scopes in cloud mode.
Changes:
- Adds
--usm-kafka-clusterand--usm-connect-clusterscope flags for role-binding create/list/delete. - Builds USM CRN scope segments and validates required environment/cluster flags for USM roles.
- Updates integration tests, test-server fixtures, and help/output goldens for USM role-binding workflows.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
internal/iam/command_rbac_role_binding.go |
Adds USM scope flags, role sets, CRN construction, and validation. |
internal/iam/command_rbac_role_binding_create.go |
Adds create examples for USM Kafka and Connect roles. |
internal/iam/command_rbac_role_binding_delete.go |
Adds delete example for USM Kafka role bindings. |
internal/iam/command_rbac_role_binding_list.go |
Adds list flags/example and renders USM scopes in list output. |
internal/iam/command_rbac_role_binding_test.go |
Adds unit tests for USM CRN construction and validation. |
test/iam_test.go |
Adds integration test cases for USM create/list/delete/error flows. |
test/test-server/iam_handlers.go |
Adds mock USM role bindings for integration tests. |
test/fixtures/output/iam/rbac/role-binding/create-help.golden |
Updates create help output. |
test/fixtures/output/iam/rbac/role-binding/create-usm-kafka-cluster-admin-cloud.golden |
Adds USM Kafka create output fixture. |
test/fixtures/output/iam/rbac/role-binding/create-usm-connect-cluster-admin-cloud.golden |
Adds USM Connect create output fixture. |
test/fixtures/output/iam/rbac/role-binding/delete-help.golden |
Updates delete help output. |
test/fixtures/output/iam/rbac/role-binding/delete-missing-role-cloud.golden |
Updates delete error/help fixture. |
test/fixtures/output/iam/rbac/role-binding/delete-usm-kafka-cluster-admin-cloud.golden |
Adds USM Kafka delete output fixture. |
test/fixtures/output/iam/rbac/role-binding/list-help.golden |
Updates list help output. |
test/fixtures/output/iam/rbac/role-binding/list-failure-help-cloud.golden |
Updates list failure help fixture. |
test/fixtures/output/iam/rbac/role-binding/list-usm-kafka-cluster-admin-cloud.golden |
Adds USM Kafka role list fixture. |
test/fixtures/output/iam/rbac/role-binding/list-user-usm-kafka-cloud.golden |
Adds USM Kafka principal list fixture. |
test/fixtures/output/iam/rbac/role-binding/list-user-usm-connect-cloud.golden |
Adds USM Connect principal list fixture. |
test/fixtures/output/iam/rbac/role-binding/missing-usm-kafka-cluster-cloud.golden |
Adds missing USM Kafka cluster error fixture. |
test/fixtures/output/iam/rbac/role-binding/missing-usm-connect-cluster-cloud.golden |
Adds missing USM Connect cluster error fixture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
`make lint-cli` rejected the new --usm-kafka-cluster / --usm-connect-cluster flag names because "usm" is not a dictionary word. Add it to vocabWords, alongside other Confluent acronyms (ksql, rbac, etc.). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|




Summary
SETU-2677 Adds CLI support for cluster-level RBAC role bindings at USM Kafka and USM Connect cluster scope. This is the
confluentCLI counterpart to cc-role-definitions#444 and section 4.3 of the Cluster-Level RBAC Implementation for USM 1-pager (Design C —usm-kafka-clusterandusm-connect-clustermodeled as independent sibling scopes ofcloud-clusterunderenvironment).Changes
--usm-kafka-clusterand--usm-connect-clusteroniam rbac role-bindingcreate/list/delete(cloud login only)./usm-kafka-cluster=<id>and/usm-connect-cluster=<id>(deliberately not abbreviated like--kafka-cluster→/kafka=).UsmKafkaClusterAdmin,UsmKafkaOperator,UsmKafkaMetricsViewer, and theUsmConnect*trio) require--environmentplus their matching USM cluster flag, mirroring the existingCloudClusterAdmin/--cloud-clusterrules.listoutput: USM bindings render asCluster Type = USM Kafka/USM Connectwith the cluster id underLogical Cluster.Note:
--roletakes the role name (e.g.UsmKafkaClusterAdmin), not the display name (UsmClusterAdmin). These roles arebindWithResource: false, so they are scope-bound and do not use--resource.Example:
Testing
create:
List
Delete:
List
Delete