[SETU-2677] Add USM cluster-level RBAC role-binding scopes to CLI#3376
Draft
Varun PV (varunpv) wants to merge 2 commits into
Draft
[SETU-2677] Add USM cluster-level RBAC role-binding scopes to CLI#3376Varun PV (varunpv) wants to merge 2 commits into
Varun PV (varunpv) wants to merge 2 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>
|
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
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:
Test plan
go test ./internal/iam/...— unit tests for CRN construction + scope validation (parseV2BaseCrnPattern)make integration-test INTEGRATION_TEST_ARGS="-run TestCLI/TestIamRbacRoleBinding"— create/list/delete against the mock server, with golden filesmake integration-test INTEGRATION_TEST_ARGS="-run TestCLI/TestHelp"— regenerated help goldens🤖 Generated with Claude Code