Add support for Orphan management policy#864
Conversation
.github/renovate.json5
Outdated
| // PLEASE UPDATE THIS WHEN RELEASING. | ||
| "baseBranches": [ | ||
| 'main', | ||
| 'release-1.18', |
There was a problem hiding this comment.
this was already done in #865, so it's odd to see here again 🤔
|
IMO the idea of management policies is that we define primitives like Observe, Create, Update, Delete that clearly state what will be done with the resources. I intentionally didnt put LateInitialize here as its a bit of an outlier and in hindsight should have been a separate feature outside of management policies. Adding more policies when we can do the same with the existing ones seems the move in the wrong direction. IMO it would just complicate things more. As its not a primitive, but a policy like If we really need a simplifier for management policies, maybe we should introduce a separate field: So you could just set |
|
@lsviben I don't disagree that adding |
In hindsight and with the context we have today, maybe it would be easier. Although I am wondering if there would be even more things popipng up along with But we should work with what we have today unless we want to make breaking changes. I just added some propositions that came to my mind how to overcome these issues without making changes to the |
Fixes #6694 Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
2caf1b9 to
4285eb2
Compare
📝 WalkthroughWalkthroughAdds a new ManagementAction value "Orphan", exposes it in v1, and updates policy resolution and reconciler checks to treat Orphan as a valid action for create/update/late-initialize flows; tests expanded to cover Orphan behavior and a test name typo was fixed. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Thanks — would you like a short changelog entry or a migration note for CRD consumers? 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apis/common/policies.go`:
- Line 25: The kubebuilder validation tag on the Policy enum uses a comma
between MustCreate and Orphan which prevents Orphan from being recognized; edit
the kubebuilder tag string (the line containing
"+kubebuilder:validation:Enum=Observe;Create;Update;Delete;LateInitialize;*;MustCreate,Orphan")
and replace the comma with a semicolon so it reads "...;MustCreate;Orphan" to
match the semicolon separators used elsewhere and ensure correct CRD validation.
4285eb2 to
51deaf0
Compare
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
51deaf0 to
7857ee9
Compare
Description of your changes
Added an Orphan management policy value which maps to ['Observe', 'Create', 'Update', 'LateInitialize'] in order to simplify the migration from
deletionPolicytomanagementPoliciesand facilitate controlled orphaning of resources.Fixes #6694 (Crossplane)
Tested using provider-kubernetes running a private branch of crossplane-runtime. Created an
Objectcontaining aSecretwith themanagementPolicies: ['Orphan']and verified that when theObjectwas deleted theSecretremained.Docs PR is crossplane/docs#993
Fixes crossplane/crossplane#6694
I have:
earthly +reviewableto ensure this PR is ready for review.- [ ] Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.