Best-practices for deterministic composed resource names
- Dominant language
- SCSS
- Stars
- 60
- Forks
- 163
- Avg merge
- 15h 20m
- Merged PRs (30d)
- 9
Description
### What's Missing?
I believe one of the problems https://github.com/crossplane/crossplane/pull/3287 intends to fix is ensuring the _external_ names of composed resources are deterministic. The idea being that if a claim was deleted and then recreated, it would result in the same set of external resources (with the same names, in the external system) being recreated.
This is useful for migrating a claim from one control plane to another. It should be possible to:
1. Ensure all composed MRs have `deletionPolicy: Orphan` so that deleting the MR does not delete the external resource.
2. Delete the claim from the 'old' control plane.
3. Create an identical claim in the 'new' control plane.
4. Have Crossplane find and adopt all of the external resources that were orphaned in step 1, as composed resources of the new claim and XR.
In theory this should be possible today, but it requires some forethought to make it work. Specifically you must ensure all composed resources have a `crossplane.io/external-name` annotation that is deterministically derived from the claim. One way to do this is by patching from the XR's `crossplane.io/claim-name` annotation as suggested in https://github.com/crossplane/crossplane/issues/3120#issuecomment-1178377398.
I believe we should document this pattern as a Composition best-practice. It doesn't have to specifically be patching from `claim-name`, but rather being thoughtful and explicit about how your `external-name` annotations are specified. If you leave this up to Crossplane it will just copy the `metadata.name` of your composed resources, which will have a random suffix and thus be non-deterministic.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.