✨ feat: add support for OCM role creation #6055
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 551 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.378
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6055"
general
weight: 0.35
nrb
<!-- Thanks for this PR! If this is your first PR please read the [contributing guide](../CONTRIBUTING.md) -->
<!-- If this PR is still work-in-progress and is being open for visibility please prefix the title with
WIP:-->What type of PR is this?
/kind feature
<!--
Add one of the following kinds:
/kind feature
/kind bug
/kind api-change
/kind cleanup
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind flake
/kind regression
/kind support
-->
What this PR does / why we need it:
This PR adds support for managing OCM roles in AWS through a new
ROSAOCMRoleConfigcontroller. This controller automates the creation, validation, and lifecycle management of OCM roles required for ROSA cluster operations.Key additions:
ROSAOCMRoleConfigCRD with validation rules (role prefix patterns, profile immutability, max lengths)The core
GetOrCreateOCMRolelogic and related helper methods are adapted from the ROSA CLI (https://github.com/openshift/rosa/pull/3262). We could not update the ROSA dependency directly due to Go directive version incompatibility between ROSA and CAPA, so the logic was ported and adapted to work within CAPA's architecture.Manual Testing:
Comprehensive manual testing was performed against real AWS and OCM infrastructure.
Test Environment:
- Kind cluster v1.35.0 (capa-test)
- CAPA controller built with Go 1.24 and ROSA feature gate enabled
tests:
- Standard & Admin profile creation with OCM linking
- Idempotency (role reuse across multiple ROSAOCMRoleConfigs)
- Self-healing (auto-restoration of missing admin tags)
- Permissions boundary attachment validation
- Custom IAM path support
- Field immutability enforcement (profile, rolePrefix)
- Singleton constraint (one OCM role per AWS account)
- Auto-reconciliation with exponential backoff
- Deletion flow with proper OCM unlink → AWS role delete sequence
- Deletion flow with
deletePolicy=Retain- Credential secret validation and error handling
<!-- Enter a description of the change and why this change is needed -->
Which issue(s) this PR fixes _(optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged)_:Fixes
https://redhat.atlassian.net/browse/ROSAENG-8292
Special notes for your reviewer:
The
GetOrCreateOCMRoleimplementation is adapted from ROSA CLI PR #3262 rather than using the ROSA dependency directly due to Go version incompatibility. The logic has been adapted to fit CAPA's controller pattern and error handling conventions.AI Usage:
Claude code was used for test infrastructure refactoring and boilerplate elimination in test files.
<!-- Declare if this PR has benefited from AI assistance in any way. Whether that's Cursor, Claude, Copilot, Codex, a local LLM, or another other AI assistant. If AI has been used please try to provide as much information as possible.
NOTE: basic autocompletion doesn't need to be declared.
If no AI assistance was used then used, write "None".
-->
Checklist:
<!-- Put an "X" character inside the brackets of each completed task. Some may be optional depending on the PR in which case these can be deleted
Please add an icon to the title of this PR, the icon will be either ⚠️ (:warning:, major or breaking changes), ✨ (:sparkles:, feature additions), 🐛 (:bug:, patch and bugfixes), 📖 (:book:, documentation or proposals), or 🌱 (:seedling:, minor or other)
-->
Release note:
<!-- Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
``
release-note
``Add ROSAOCMRoleConfig controller for automated OCM role management in AWS, supporting Admin, Standard, and NoConsole role profiles.