RFE-9410: Add UI option to preserve managed clusters during cluster deletion from ACM#6325
Conversation
Adds a "Preserve cluster infrastructure on delete" checkbox to the destroy cluster confirmation dialog for ACM-provisioned (Hive-backed) clusters. When checked, the UI patches spec.preserveOnDelete=true on the ClusterDeployment before proceeding with deletion. If the patch fails the deletion is aborted and an error is surfaced to the user. Checkbox is not shown for Hypershift/Hosted clusters. Signed-off-by: mihirlele <mihirlele@users.noreply.github.com>
…urces on delete" More accurate phrasing — the checkbox prevents deletion of provisioned cluster resources (VMs, VPCs, instances, etc.) rather than generic infrastructure. Also removes _specs/ and _plan/ from .gitignore. Signed-off-by: mihirlele <mihirlele@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mihirlele The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR adds cluster-deletion preservation support. ChangesPreserve-on-delete cluster deletion
Sequence DiagramsequenceDiagram
participant User
participant ClusterActionDropdown
participant BulkActionModal
participant deleteCluster
participant ClusterDeployment API
User->>ClusterActionDropdown: Click Destroy
ClusterActionDropdown->>BulkActionModal: Open with enablePreserveOnDelete
BulkActionModal->>User: Show preserve-on-delete checkbox
User->>BulkActionModal: Toggle checkbox, click confirm
BulkActionModal->>ClusterActionDropdown: Call actionFn with preserveOnDelete
ClusterActionDropdown->>deleteCluster: Call with preserveOnDelete flag
deleteCluster->>ClusterDeployment API: PATCH spec.preserveOnDelete=true
ClusterDeployment API-->>deleteCluster: Patch succeeds
deleteCluster->>ClusterDeployment API: DELETE cluster resource
ClusterDeployment API-->>deleteCluster: Deletion complete
deleteCluster-->>ClusterActionDropdown: Success
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Satisfies docstring coverage threshold for the functions modified in this PR. Signed-off-by: mihirlele <mihirlele@users.noreply.github.com>
|
/retest |
Signed-off-by: mihirlele <mihirlele@users.noreply.github.com>
|
/retest |
|
/hold |
|
@mihirlele This looks great! I just have a few questions I would like discuss.
|
|
@fxiang1 thanks! yes I can add it for the bulk destroy too! I am proposing another option for solving the second issue. How about we create a separate option for enabling preserve on delete/disabling preserve on delete (possibly in between detach and destroy). If preserve on delete is enabled, we can modify the destroy warning to also say that since preserve on delete is enabled, it will end up retaining the resources. |
@mihirlele I'm just wondering how would this work? So we'll have another item in the table row action menu to enable/disable preserve on delete? Maybe you can do a mock up design? Thanks!
|
|
@fxiang1 sure. I will share a short recording of how it would look like. |
|






📝 Summary
Ticket Summary (Title):
Add "Preserve cluster resources on delete" option to cluster destroy
dialog
Type of Change:
✅ Checklist
General
ACM-12340 Fix bug with...)(English only)
interfaces
If Feature
🗒️ Notes for Reviewers
This feature adds a "Preserve cluster resources on delete"
checkbox to the destroy cluster confirmation dialog for
ACM-provisioned (Hive-backed) clusters. When checked, the UI patches
spec.preserveOnDelete: trueon theClusterDeploymentbeforeissuing any delete calls. If the patch fails (e.g. RBAC error,
resource not found), the deletion is aborted entirely and an error
is shown in the dialog — no cluster resources are touched.
Key behaviour:
Hypershift/Hosted clusters (no
ClusterDeployment)Files changed:
BulkActionModal.tsxenablePreserveOnDeleteprop +delete-cluster.tspreserveOnDeleteparam +ClusterActionDropdown.tsxcluster-deployment.tspreserveOnDelete?: booleantoClusterDeploymentspec typetranslation.jsondelete-cluster.test.tsTo test the abort path, apply a
ValidatingWebhookConfigurationpointing at an unreachable URL with
failurePolicy: FailonclusterdeploymentsUPDATE — see PR description for the exactsnippet.
Summary by CodeRabbit
Release Notes