Incorporate convert command#5275
Conversation
|
While writing comments/help I noticed that I am using Maybe I also got into my head because the issue this fixes was to "Migrate a command" 😕 , so from migrating a command I started to think migrate command 🕵️ |
|
I will put my vote in for |
|
Renamed the command to |
phisco
left a comment
There was a problem hiding this comment.
LGTM! thanks @lsviben and @stevendborrelli for the original implementation!
A nice future addition would be to avoid outputting all the [], {} and nulls, but that's just cosmetic.
Would be nice to use this to convert all the compositions we have in the e2es and run them all with those 🤔
Piotr1215
left a comment
There was a problem hiding this comment.
Thank you @stevendborrelli and @lsviben for this awesome functionality. This will be very helpful, especially when converting compositions. Did a quick test and functionality works as expected, converted sample GCP composition creating a storage bucket and applied without issues.
| Render render.Cmd `cmd:"" help:"Render a composite resource (XR)."` | ||
| Trace trace.Cmd `cmd:"" help:"Trace a Crossplane resource to get a detailed output of its relationships, helpful for troubleshooting."` | ||
| XPKG xpkg.Cmd `cmd:"" help:"Manage Crossplane packages."` | ||
| Convert convert.Cmd `cmd:"" help:"Convert a Crossplane resource to a newer version or kind."` |
There was a problem hiding this comment.
The help message is very generic, is it intended to capture potential future implementations?
There was a problem hiding this comment.
Yes, convert <something> is supposed to be the place where we put the conversion helpers when we need
| ) | ||
|
|
||
| // Cmd converts a Crossplane resource to a newer version or a different kind. | ||
| type Cmd struct { |
There was a problem hiding this comment.
Maybe a small suggestion for future improvement. Since we know the type we are converting from (composition, controllerconfig, etc), could the command infer it from the kind rather than require user to provide the type? It would simplify the options for conversion and wouldn't require parameter changes when we add more conversion pairs.
There was a problem hiding this comment.
I thought about something like this. But then got discouraged when I saw that pipelinecomposition has an additional flag. So its seems better to have separate sub-commands that can decide on their flags. Having it all under one cmd and infering, then applying flags seemed messy. But not saying its not the way to go in the future if we decide so
Signed-off-by: lsviben <sviben.lovro@gmail.com>
- add serviceAccountName to template - lots of naming changes - fixing lint issues - change name of command to convert - fix nil pointer in name gen for pipeline - modify help info - change input file flags to args - extract common io code to separate package Signed-off-by: lsviben <sviben.lovro@gmail.com>
|
@Piotr1215 we migrated all upbound/platform-ref-aws/azure/gcp compositions ;) all good |
Description of your changes
Transfers the migrate command from https://github.com/crossplane-contrib/crossplane-migrator to
the Crossplane CLI as
convertThe PR mostly copies over the commands into the Crossplane CLI. Some notable changes:
new-pipeline-composition/new-deployment-runtimetopipeline-composition/deployment-runtimeBig thanks to @stevendborrelli for the original implementation!
Fixes #4922
I have:
make reviewableto ensure this PR is ready for review.[] Added or updated e2e tests.[] Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.
How the command works
crossplane beta --helpcrossplane beta convert --helpControllerConfig -> DeploymentRuntimeConfig
Patch-and-Transform Composition to Function Pipeline Composition