Add opt-in cleanup policy for related-resource copies#181
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
|
Hi @wojciech12. Thanks for your PR. I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
For `origin: service` related resources the agent never prunes a copy when its
origin object is deleted mid-life; the copy is orphaned permanently (no
per-object finalizer, no set-diff). Even on primary teardown, copies whose
origin already vanished are not reclaimed.
Add a `cleanupPolicy` field to RelatedResourceSpec with three values:
- Orphan (default): copies are never deleted (== legacy cleanup:false).
- OnPrimaryDeletion: copies deleted only on primary deletion (== legacy cleanup:true).
- MatchOrigin: a copy is pruned as soon as its origin object is gone, and all
copies are deleted on primary teardown (also reclaiming mid-life orphans).
The prune is List-and-diff driven by the primary reconcile, never a finalizer on
related objects (issues kcp-dev#172/kcp-dev#116). Copies are labelled with owning-primary and
identifier provenance so only agent-created copies are ever deleted, scoped to
the destination client so the origin object is never touched. The List is
cluster-wide (scoped by the provenance label selector) so copies mapped into a
different namespace via spec.object.namespace rewrites are pruned too. The
deprecated `cleanup` bool is still honoured via EffectiveCleanupPolicy(). CEL
rules require `watch` for MatchOrigin+origin:service and reject cleanup:true+Orphan.
Extends the opt-in cleanup work from kcp-dev#114 (PR kcp-dev#164).
Signed-off-by: wojciech12 <wojciech.barczynski@kubermatic.com>
bb0462a to
62c8745
Compare
For
origin: servicerelated resources the agent never prunes a copy when its origin object is deleted mid-life; the copy is orphaned permanently (no per-object finalizer, no set-diff). Even on primary teardown, copies whose origin already vanished are not reclaimed.Add a
cleanupPolicyfield to RelatedResourceSpec with three values:The prune is List-and-diff driven by the primary reconcile, never a finalizer on related objects (issues #172/#116). Copies are labelled with owning-primary and identifier provenance so only agent-created copies are ever deleted, scoped to the destination client so the origin object is never touched. The List is cluster-wide (scoped by the provenance label selector) so copies mapped into a different namespace via spec.object.namespace rewrites are pruned too. The deprecated
cleanupbool is still honoured via EffectiveCleanupPolicy(). CEL rules requirewatchfor MatchOrigin+origin:service and reject cleanup:true+Orphan.Extends the opt-in cleanup work from #114 (PR #164).
Summary
What Type of PR Is This?
/kind feature
Related Issue(s)
Fixes #
Release Notes
Add a
cleanupPolicyfield to RelatedResourceSpec with three values: