Skip to content

feat(clusters): reconcile deletion policy - #2152

Open
jellonek wants to merge 1 commit into
mainfrom
deletionPolicy
Open

feat(clusters): reconcile deletion policy#2152
jellonek wants to merge 1 commit into
mainfrom
deletionPolicy

Conversation

@jellonek

@jellonek jellonek commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

This PR is introducing requested in #2089 deletion policy on cluster object level, which when set to Retain iterates over plugins

  • updating plugin.spec.deletionPolicy to Retain
  • removing the plugin

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Closes #2089

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help
  • Separate ticket for tests # (issue/pr)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

Copilot AI lite review requested due to automatic review settings August 4, 2026 11:10
@jellonek
jellonek requested a review from a team as a code owner August 4, 2026 11:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.EnsureCreated and 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 thread internal/controller/cluster/cluster_controller.go Outdated
Comment thread api/well_known.go
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
jellonek force-pushed the deletionPolicy branch 5 times, most recently from 12bf2f0 to 9688b87 Compare August 11, 2026 08:39
Closes #2089

Signed-off-by: Piotr Skamruk <piotr.skamruk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] - DeletionPolicy retain on Cluster level

2 participants