feat(clusters): reconcile deletion policy - #2152
Open
jellonek wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a cluster-level deletion policy (via annotation) that, when set to Retain, reconciles existing Plugin resources for that Cluster by setting plugin.spec.deletionPolicy=Retain and then deleting the Plugin objects (so their managed resources are retained).
Changes:
- Trigger deletion-policy reconciliation during
RemoteClusterReconciler.EnsureCreatedand requeue while Plugins still exist. - Add logic to list cluster-bound Plugins, set their deletion policy to
Retain, and delete them. - Introduce a new well-known annotation key constant for the cluster-level deletion policy.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/controller/cluster/cluster_controller.go | Adds reconciliation flow to retain plugin-managed resources by setting plugin deletion policy and deleting Plugins when the cluster annotation is set. |
| api/well_known.go | Defines a new well-known annotation key for cluster-level deletion policy control. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+132
to
+136
| if count, err := r.reconcileDeletionPolicy(ctx, cluster); err != nil { | ||
| return ctrl.Result{}, lifecycle.Failed, err | ||
| } else if count > 0 { | ||
| return ctrl.Result{RequeueAfter: 10 * time.Second}, lifecycle.Pending, nil | ||
| } |
jellonek
force-pushed
the
deletionPolicy
branch
5 times, most recently
from
August 11, 2026 08:39
12bf2f0 to
9688b87
Compare
Closes #2089 Signed-off-by: Piotr Skamruk <piotr.skamruk@gmail.com>
jellonek
force-pushed
the
deletionPolicy
branch
from
August 11, 2026 09:48
9688b87 to
35d1de8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR is introducing requested in #2089 deletion policy on cluster object level, which when set to
Retainiterates over pluginsplugin.spec.deletionPolicytoRetainWhat type of PR is this? (check all applicable)
Related Tickets & Documents
Closes #2089
Added tests?
Checklist