-
Notifications
You must be signed in to change notification settings - Fork 899
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
Support loading crossplane beta render
inputs from stdin
#5630
base: master
Are you sure you want to change the base?
Conversation
This uses the standard convention of a file named "-" meaning "read this file from stdin". The XR and Composition are assumed to be single YAML files, while functions and observed resources could be a stream. Signed-off-by: Nic Cope <nicc@rk0n.org>
Sounds reasonable to me, we should probably error if more than one input is "-" to avoid hanging indefinitely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
files = append(files, fileOrDir) | ||
} else { | ||
|
||
files := []string{fileOrDir} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the previous code, we would avoid adding fileOrDir
to the files
list if it was a directory. Is it correct to go ahead and add it to the files
list here now? Will that cause a problem later on in this func when we range
over the files
list and call LoadYAMLStreamFromFile
on each of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah nevermind, it shouldn't be an issue, because in the case of a directory we end up overwriting the files
list with the yamls
list that comes back from getYAMLFiles()
. sounds good!
I also took this for a quick test spin with the demo scenario in https://github.com/jbw976/demo-xfn/tree/main/kcl. It looks like it works correctly when you pipe various resources to
Example output of piping the composition to stdin:
|
FWIW, this was mostly a POC. Following up to get it to the finish line isn't a priority for me, unfortunately. I'm happy if someone else wants to take it and run with it. 🙂 |
Description of your changes
This uses the standard convention of a file named "-" meaning "read this file from stdin". The XR and Composition are assumed to be single YAML files, while functions and observed resources could be a stream.
I have:
make reviewable
to ensure this PR is ready for review.Added or updated unit tests.Added or updated e2e tests.Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.y
labels to auto-backport this PR.Need help with this checklist? See the cheat sheet.