← Back to Pull requests

✨ feat: add support for OCM role creation #6055

Closed
unknown closed this pull request without merging on Jul 08, 2026 19:32 UTC
View on GitHub
unknown unknown commented on Jun 16, 2026 17:42 UTC
Author

<!-- 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 ROSAOCMRoleConfig controller. This controller automates the creation, validation, and lifecycle management of OCM roles required for ROSA cluster operations.

Key additions:

  • New ROSAOCMRoleConfig CRD with validation rules (role prefix patterns, profile immutability, max lengths)

  • Controller that reconciles OCM role resources and links them to OCM organizations

  • Support for multiple role profiles (Admin, Standard, NoConsole)

  • Self-healing capabilities for role tags and policies
  • The core GetOrCreateOCMRole logic 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 GetOrCreateOCMRole implementation 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)
    -->

  • squashed commits

  • includes documentation

  • includes AI generated content

  • includes emoji in title

  • adds unit tests

  • adds or updates e2e tests
  • 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.
    ``

    Diff: 551 lines (+413 / -138) across 6 files Reviewer: nrb Review duration: 31789m
    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
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48.1% (MEDIUM) · Higher = larger blast radius
    48.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19% · Safe to merge
    19%