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 support for categorical converters #217

Merged
merged 20 commits into from
Jul 7, 2023

Conversation

ulucinar
Copy link
Collaborator

@ulucinar ulucinar commented Jun 14, 2023

Description of your changes

This PR adds support for the categorical converters, which allows converters to work on the whole category of resources, such as the managed resources. The migration registry allows registration of category converters via the Registry.RegisterCategoricalConverter function and categorical converters receive and act on unstructured objects.

It also introduces support for categorical preprocessors: A registered (with the migration registry) preprocessor is guaranteed to be run before any registered converters are run. Preprocessors can currently be registered for the CRD categories and they can be used to alter (to supply parameters to) the behavior of any converters run downstream.

We also introduce support for converters of various types such as Crossplane's Configuration.pkg, Configuration.meta, Provider.pkg, Lock.pkg, etc., which will be employed in various migrators targeting conversions from (community or official) monoliths to provider families.

We also add the migration.PlanExecutor supporting migration.ExecutorCallback. A PlanExecutor is responsible for driving the execution of the Steps of a migration Plan using its configured Executor. The repo currently hosts a single Executor implementation: migration.ForkExecutor, which can execute migration plan steps by forking child processes. ExecutorCallback implementations can be used to be notified:

  • Just before a migration Step is executed. This allows a callback implementation to skip or continue with the execution of the Step or may be used to cancel the execution of the Plan.
  • After a successful execution of a migration Step. This allows an implementation to be notified of a successful step execution and the execution of the Plan can be cancelled.
  • After a Step execution failure: This allows an implementation to be notified of a failed step execution and the Step execution may be repeated (for instance after editing any resource manifests or patch documents the Step refers to), skipped, or the Plan execution can be cancelled.

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

The PR has been tested using upbound/extensions-migration#12.

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
@ulucinar ulucinar marked this pull request as draft June 14, 2023 14:43
@ulucinar ulucinar force-pushed the categorical-converters branch 2 times, most recently from 2605aa4 to ad98956 Compare June 20, 2023 18:38
@ulucinar ulucinar marked this pull request as ready for review June 21, 2023 06:44
ulucinar and others added 5 commits June 21, 2023 16:00
@ulucinar ulucinar force-pushed the categorical-converters branch 8 times, most recently from 0e39407 to 5413b2d Compare July 3, 2023 23:45
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
- Do not use dynamic Client for categorical retrieval with the Kubernetes source

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
sergenyalcin and others added 2 commits July 5, 2023 13:09
Signed-off-by: Sergen Yalçın <[email protected]>
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
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.

Thanks @ulucinar LGTM!

@ulucinar ulucinar merged commit 90af5e5 into crossplane:main Jul 7, 2023
@ulucinar ulucinar deleted the categorical-converters branch July 7, 2023 15:11
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