Skip to content

[RHCLOUD-47517] Validate the migrate from RBAC v1 to V2 - #130

Merged
astrozzc merged 8 commits into
project-kessel:mainfrom
Ellen-Yi-Dong:validate-rbac-v1-to-v2
Aug 25, 2026
Merged

[RHCLOUD-47517] Validate the migrate from RBAC v1 to V2 #130
astrozzc merged 8 commits into
project-kessel:mainfrom
Ellen-Yi-Dong:validate-rbac-v1-to-v2

Conversation

@Ellen-Yi-Dong

@Ellen-Yi-Dong Ellen-Yi-Dong commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Related JIRA link: https://redhat.atlassian.net/browse/RHCLOUD-47517

Acceptance Criteria listed in the JIRA ticket:

  • Review and update the migrate-from-rbac-v1-to-v2.mdx page and confirm its accuracy
  • Remove the “Under Construction” banner after verifying
  • Submit a PR to the public docs repo for any changes required

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive reference for migrating RBAC v1 authorization patterns to v2.
    • Expanded migration guidance with supported patterns, request translations, role bindings, testing, deployment, and workspace handling.
    • Replaced outdated external links and deployment instructions with current internal references.
    • Corrected permission identifiers, gRPC guidance, and documentation formatting.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bdfe7cf3-144f-41d1-bf0f-8e07a282a644

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bc29f300-dd07-4d67-b421-1c8fa69a49a7

📥 Commits

Reviewing files that changed from the base of the PR and between 0148085 and 0920ba9.

📒 Files selected for processing (1)
  • src/content/docs/building-with-kessel/reference/migration-pattern-reference.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/content/docs/building-with-kessel/reference/migration-pattern-reference.md

📝 Walkthrough

Walkthrough

The PR adds a migration pattern reference for RBAC v1-to-v2 authorization. It updates the migration guide with internal links, expanded testing guidance, corrected identifiers, deployment references, and Astro/Starlight syntax.

Changes

RBAC v1-to-v2 migration documentation

Layer / File(s) Summary
Pattern selection and migration constraints
src/content/docs/building-with-kessel/reference/migration-pattern-reference.md, src/content/docs/building-with-kessel/how-to/migrate-from-rbac-v1-to-v2.mdx
Defines migration constraints, a pattern summary, a decision tree, and internal reference links.
Workspace authorization patterns
src/content/docs/building-with-kessel/reference/migration-pattern-reference.md
Documents five authorization patterns for workspace-aware resources, Default Workspace assets, Root Workspace settings, and organization-level settings.
Migration implementation and role configuration
src/content/docs/building-with-kessel/reference/migration-pattern-reference.md, src/content/docs/building-with-kessel/how-to/migrate-from-rbac-v1-to-v2.mdx
Documents access-grant migration rules, role definitions, gRPC usage, workspace lookup and caching, and a corrected permission identifier.
Testing and supporting guide updates
src/content/docs/building-with-kessel/how-to/migrate-from-rbac-v1-to-v2.mdx, src/content/docs/building-with-kessel/reference/migration-pattern-reference.md
Adds authorization testing guidance, replaces deployment instructions with an InScope reference, converts a note to Astro/Starlight syntax, and adds further-reading links.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Mergeability Score: ⚪ Minimal · up to 0920b

This documentation-focused change has no actionable merge-blocking risk remaining and is merge-ready after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the RBAC v1-to-v2 migration documentation validation, which matches the primary objective and changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Nitpick comments (1)
src/content/docs/building-with-kessel/reference/migration-pattern-reference.md (1)

395-397: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Align the caching guidance with the migration guide.

The Node, Python, and Ruby SDK workspace helpers issue the RBAC request directly and do not provide built-in caching. Remove the SDK caching claim, or identify an SDK and version that implements it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/content/docs/building-with-kessel/reference/migration-pattern-reference.md`
around lines 395 - 397, Update the Caching section to remove the claim that
Kessel client libraries provide built-in caching, or replace it with a specific
SDK and version that demonstrably supports this behavior. Preserve the guidance
to cache immutable workspace IDs while accurately reflecting the Node, Python,
and Ruby SDK implementations.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/content/docs/building-with-kessel/how-to/migrate-from-rbac-v1-to-v2.mdx`:
- Around line 347-349: Remove the remaining ephemeral-environment authentication
and credential runbook content following the “Deploying Kessel in an ephemeral
environment” Aside, including Keycloak credential extraction, token creation,
RBAC and token-validation changes, secret creation, and pod deletion steps. Keep
only the VPN-marked InScope reference in the public page, or move the full
section to internal documentation.
- Around line 34-40: Update the migration decision tree by adding a Pattern 1
branch for workspace-aware low-cardinality or high-access resources, including
host operations, and add coverage for workspace-aware non-host resources. Narrow
the existing Pattern 2 bullet to workspace-aware resources that meet its
high-cardinality, low-access thresholds, using the terminology and links from
the Migration Pattern Reference.

In
`@src/content/docs/building-with-kessel/reference/migration-pattern-reference.md`:
- Around line 26-32: Define how the cardinality thresholds apply at exactly
10,000 results and exactly 80% accessibility across the referenced pattern
criteria. Update the table and corresponding sections to use inclusive,
non-overlapping boundaries or explicitly document a tie-break rule so every case
maps to a pattern.
- Line 38: Add language identifiers to every fenced code block in the migration
pattern reference: use text for ASCII tree blocks, zed or text for the schema
block, and http for the request block, including the blocks around lines 38,
160, 317, and 366.
- Around line 14-20: Update “The Compatibility Constraint” to describe downward
inheritance: a role binding at a workspace or ancestor may authorize checks at
that workspace or its descendants, while a descendant binding cannot authorize
checks at an ancestor. Replace the exact-level-match requirement and adjust the
example to reflect this compatibility rule, keeping the surrounding coordination
guidance intact.
- Around line 362-365: Update the “Looking Up Built-In Workspaces” section to
state that workspace lookup requests use the service’s own OAuth token, include
the x-rh-rbac-org-id header, and must not forward x-rh-identity; alternatively,
link directly to the migration guide section documenting these requirements.
- Around line 349-358: Update the “Why gRPC” section to link StreamedListObjects
to its kessel.inventory.v1beta2 definition in the Buf Schema Registry, and
explicitly state that /api/rbac/v2 calls are RBAC management endpoints rather
than Inventory API endpoints. Preserve the existing gRPC rationale and SDK
links.
- Around line 89-94: Update the “Detail views / writes” guidance in the
migration pattern reference to require CheckForUpdate for reads that expose
credentials or other highly sensitive data, while retaining Check for ordinary
reads and CheckForUpdate for writes.

---

Nitpick comments:
In
`@src/content/docs/building-with-kessel/reference/migration-pattern-reference.md`:
- Around line 395-397: Update the Caching section to remove the claim that
Kessel client libraries provide built-in caching, or replace it with a specific
SDK and version that demonstrably supports this behavior. Preserve the guidance
to cache immutable workspace IDs while accurately reflecting the Node, Python,
and Ruby SDK implementations.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 51baa36a-927c-4a8f-8663-51ebeaf53bc5

📥 Commits

Reviewing files that changed from the base of the PR and between fc85989 and 0148085.

📒 Files selected for processing (2)
  • src/content/docs/building-with-kessel/how-to/migrate-from-rbac-v1-to-v2.mdx
  • src/content/docs/building-with-kessel/reference/migration-pattern-reference.md

Comment on lines +26 to +32
| Category | Pattern | When to Use (all conditions satisfied) | Examples |
|----------|---------|---------------------------------------|----------|
| Workspace-aware assets | [1. Native](#pattern-1-native-workspace-aware-low-cardinality) | Resource is workspace-aware AND EITHER queries return <10k results OR >80% of results are accessible | Workspaces, Hosts (low-cardinality ops) |
| Workspace-aware assets | [2. Native workspace-level list](#pattern-2-native-workspace-level-list-workspace-aware-high-cardinality) | Resource is workspace-aware AND queries return >10k results AND <80% of results are accessible | Hosts (high-cardinality ops) |
| Non-workspace-aware assets | [3. Default Workspace](#pattern-3-default-workspace-non-workspace-aware-assets) | Resource is NOT workspace-aware AND can be conceptualized as an "asset" (customer manages CRUD; could be placed in a workspace) | Repositories, SCAP policies |
| Org-wide settings | [4. Root Workspace](#pattern-4-root-workspace-org-wide-asset-centric-settings) | Resource is the organization AND the operation is "asset-centric" (could be workspace-level in the future) | Advisor recommendation acknowledgement |
| Org-wide settings | [5. Organization-level](#pattern-5-organization-level-non-asset-centric-settings) | Resource is the organization AND the operation is NOT asset-centric (would never belong at workspace level) | Authentication policy |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Define the boundary cases for the cardinality thresholds.

Pattern 1 uses <10,000 or >80%. Pattern 2 uses >10,000 and <80%. Exactly 10,000 results or exactly 80% accessible results match neither pattern. Define inclusive boundaries or document a tie-break rule.

Also applies to: 41-44, 66-70, 131-133

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/content/docs/building-with-kessel/reference/migration-pattern-reference.md`
around lines 26 - 32, Define how the cardinality thresholds apply at exactly
10,000 results and exactly 80% accessibility across the referenced pattern
criteria. Update the table and corresponding sections to use inclusive,
non-overlapping boundaries or explicitly document a tie-break rule so every case
maps to a pattern.


## Decision Tree

```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add language identifiers to every fenced code block.

markdownlint-cli2 reports MD040 at Lines 38, 160, 317, and 366. Use text for the ASCII trees, zed or text for the schema block, and http for the request block.

Proposed fix
-```
+```text

Also applies to: 160-160, 317-317, 366-366

🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 38-38: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/content/docs/building-with-kessel/reference/migration-pattern-reference.md`
at line 38, Add language identifiers to every fenced code block in the migration
pattern reference: use text for ASCII tree blocks, zed or text for the schema
block, and http for the request block, including the blocks around lines 38,
160, 317, and 366.

Source: Linters/SAST tools

Ellen-Yi-Dong and others added 4 commits August 13, 2026 19:30
…ern-reference.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
… in ephemeral with an example of a possible solution

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The banner still exist


### Caching

The Default and Root Workspace IDs are **immutable** for a given tenant. Cache them aggressively to avoid the latency and reliability cost of an RBAC lookup on every request. This lookup adds extra latency and a dependency on RBAC availability. Kessel client libraries are expected to encapsulate this lookup with built-in caching of these immutable values.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the How-to (lines 199–201) says don't cache; which is right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the document to mention to don't cache! 😅 😅 😅

@Ellen-Yi-Dong
Ellen-Yi-Dong requested a review from astrozzc August 24, 2026 16:22

@astrozzc astrozzc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good to me

Comment on lines +369 to +370
GET /api/rbac/v2/workspaces/?type=root
GET /api/rbac/v2/workspaces/?type=default

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now we add the ?with_ancestry=true to bypass permission check

@astrozzc
astrozzc merged commit d6232d9 into project-kessel:main Aug 25, 2026
3 checks passed
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