Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best-practices for deterministic composed resource names #432

Open
negz opened this issue May 3, 2023 · 0 comments
Open

Best-practices for deterministic composed resource names #432

negz opened this issue May 3, 2023 · 0 comments

Comments

@negz
Copy link
Member

negz commented May 3, 2023

What's Missing?

I believe one of the problems crossplane/crossplane#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 crossplane/crossplane#3120 (comment).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants