Rename examples/conversion.ConvertSingletonListToEmbeddedObject as ApplyAPIConverters#538
Merged
Merged
Conversation
…plyAPIConverters Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
This was referenced Oct 16, 2025
erhancagirici
approved these changes
Oct 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
This PR changes the existing
examples/conversion.ConvertSingletonListToEmbeddedObjectin the following ways:ApplyAPIConvertersbecause it applies all the registered API converters, not just the singleton-list-to-embedded-object converter.ConvertSingletonListToEmbeddedObjectused to convert thev1beta1versions into the new versions. However, we should already be generating the new version from the hopefully updated registry examples corresponding to that new version. So instead of a direct conversion from the old API, we had better have it generated from the new registry examples corresponding to that version and apply the registered converters on them.Please note that this only applies the API converters on the latest generated version. Any old versions are kept intact. This is meant to be run in a post processing step for the generated manifests.
A provider's code and example manifest generation pipeline could run this as follows (in a post-processing phase):
, where
pcis theconfig.Providerwhich happens to hold the API converters registered for the resources. The../examples-generated/clusteris the root path under which the generated example manifests are to be processed.../hack/boilerplate.yaml.txtis the license header to be appended to the processed documents.As a future work, we could turn what we currently have in
ApplyAPIConvertersinto a chain of post processors run for the generated manifests and probably decouple the license header adder from the API converter applier.I have:
make reviewableto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
Tested against
crossplane-contrib/provider-upjet-{aws,azuread}: