ARO-27732 - Remove the orphaned resources #5652
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 · 547 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.377
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5652"
general
weight: 0.35
ziccardi
<!-- Link to Jira issue -->
What
Implement a new periodic controller to identify and clean up orphaned Azure cluster managed resource groups.
The controller:
SubscriptionWatchingControllerpattern.- have a
ManagedByvalue;- are in the backend Azure location;
- are managed by an HCP OpenShift cluster resource ID.
ManagedByresource ID points to an HCP cluster that no longer exists.Environment variables
The controller is guarded behind environment variables so it can be rolled out safely:
CLEAN_ORPHANED_MANAGED_RESOURCE_GROUPS=enabled- Enables the orphaned managed resource group cleanup controller.
- If this variable is not set to
enabled, the controller is not started.CLEAN_ORPHANED_MANAGED_RESOURCE_GROUPS_MODE=readwrite- Allows the controller to initiate deletion of orphaned managed resource groups.
- By default, the controller runs in read-only mode and only logs what would be deleted.
This allows the controller to be deployed first in detection/read-only mode, observed through logs, metrics, and alerts, and then switched to read-write mode once we are confident in the results.
Alerts and metrics
The PR adds Prometheus metrics for:
The PR also adds alerts for:
Why
A previously identified race condition could leave Azure managed resource groups orphaned when cluster resources were not cleaned up correctly.
Although the underlying race condition has been resolved, orphaned managed resource groups may still exist in customer subscriptions as a result of the historical bug.
This controller provides the foundation for detecting and eventually removing those orphaned resources, helping reduce resource sprawl and unnecessary Azure consumption.
Testing
<!--
Testing is required for feature completion and tests should
be part of the pull request along with the feature changes.
Describe the testing provided (unit, integration, e2e).
If you did not add tests, provide a clear justification.
-->
Special notes for your reviewer
The controller relies on the
ManagedByresource ID to determine whether a managed resource group is still associated with an existing HCP OpenShift cluster.A managed resource group is considered orphaned only when:
ManagedByvalue.ManagedByvalue points to an HCP OpenShift cluster resource ID.The commit history is intentionally granular to make the review easier. It will be squashed before merge.
PR Checklist