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

Add Patch migration step type #153

Merged
merged 6 commits into from
May 16, 2023
Merged

Add Patch migration step type #153

merged 6 commits into from
May 16, 2023

Conversation

ulucinar
Copy link
Collaborator

@ulucinar ulucinar commented Jan 26, 2023

Description of your changes

This PR proposes to add the Patch step type to the migration plan and converts the following steps to this new type:

  • pause-managed
  • pause-composites
  • edit-composites
  • edit-claims
  • deletion-policy-orphan
  • start-managed
  • start-composites

As an example, the generated manifest for pausing a managed resource in the pause-managed migration plan step now looks like the following:

apiVersion: fakesourceapi/v1alpha1
kind: VPC
metadata:
  annotations:
    crossplane.io/paused: "true"
  name: sample-vpc

And the corresponding migration step now looks like the following:

spec:
  steps:
  - patch:
      type: merge
      files:
      - pause-managed/sample-vpc.vpcs.fakesourceapi.yaml
    name: pause-managed
    type: Patch
...

This PR also adds migration.PatchSetConverter for converting Composition-wide PatchSets without the context of a target ComposedTemplate. Global PatchSet conversions, like a tag conversion can be performed with these converters. migration.PatchSetConverters are invoked before Composition converters and if a converted PatchSet's schema is compatible with the migration targets, it's automatically inherited if the source has a reference to the same name.

The migration.Converter.Composition API now accepts only the subset of PatchSets that are referenced by the migration source.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Tested manually using a sample migrator.

…targets if they conform to the target's schema

- Remove patches from targets if the patch target/source field does not exist or is of a different type in the target
- Include patches in targets if the patch target/source field exists and is of the same type in the target

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
- Convert migration plan steps
  pause-managed, pause-composites, edit-composites, edit-claims,
  deletion-policy-orphan, start-managed, start-composites
  to this Patch type

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
PatchSet conversion is handled by PatchSet converters with global context

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
…ation.ComposedTemplateConverter

for decoupling and modularizing converters.

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
Copy link
Member

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

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

This PR has already reviewed in here #173

Thanks @ulucinar LGTM!

@ulucinar
Copy link
Collaborator Author

Thanks @sergenyalcin!

@ulucinar ulucinar merged commit f592087 into crossplane:main May 16, 2023
@ulucinar ulucinar deleted the fix-e87 branch May 16, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants