-
Notifications
You must be signed in to change notification settings - Fork 900
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
Rearrange the crossplane
subcommands
#4832
Conversation
Edit: updated the PR to use compact. I personally found the tree view pretty ugly/hard to read with the new layout so I reverted that. Not sure if that will be controversial. Some other options available to us are to skip expanding subcommands by default, which looks like:
Or to get compact help, which looks like:
|
I like the compact view the best! I agree that the tree view is now too big and unwieldy and it will only get worse with more commands that we add. I do like having subcommands expanded so the user knows everything they can do up front without having to spelunk manually down through all the commands and get help for all of them. Compact help seems to be a good balance of all that for now - we can always revisit if that gets too large in the future. |
So this means that these commands would go away, right?
|
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.
Thanks for taking this clean-up effort on @negz!! took a quick pass through now with a few comments, but no major objections to anything here 🙇
0d8d7f3
to
320fee9
Compare
} | ||
return b.String() |
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.
FYI this renders like this:
remote:
$ go run cmd/crank/main.go beta xpkg init --help
Usage: crossplane beta xpkg init <name> <template>
Initialize a package from a template.
Crossplane initializes a package by using git to clone a template from a
repository. The template can be either a git repository URL, or a well-known
template name.
Crossplane supports the following well-known-template names:
- provider-minimal (https://github.com/crossplane/provider-template)
- provider-upjet (https://github.com/upbound/upjet-provider-template)
- function-go (https://github.com/crossplane/function-template-go)
Arguments:
<name> Name of the package to initialize.
<template> Template to initialize the package from.
Flags:
-h, --help Show context-sensitive help.
-v, --version Print version and quit.
--verbose Print verbose logging statements.
-d, --directory="." Path of the directory to initialize.
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.
A few feedbacks:
- I preferred keeping the beta/alpha commands where they would be without the beta/alpha prefix, as that would mean promoting them would be a 1 line change instead of moving all the related files.
- I like the direction of
--embed-runtime-image
, I think it conveys better how the image is being used by the build subcommands, however embed suggests it's a Boolean, I'd rather have it as--embedded-runtime-image
probably. - I guess you switched the tree view off because it wasn't playing nicely with having a single top subcommands, is this the case? I prefer the tree view, but I also found the default visualization not to work so well in this case
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.
The commands were modified in this PR but we should update cmd/crank/beta/render/cmd.go
type Cmd struct {
CompositeResource string `arg:"" type:"existingfile" help:"A composite resource (XR) YAML file to render."`
Composition string `arg:"" type:"existingfile" help:"A Composition YAML file to use."`
Functions string `arg:"" help:"A stream or directory of YAML files containing the Composition Functions to use."`
ContextValues map[string]string `placeholder:"KEY=JSON-VALUE;..." help:"Semicolon-separated JSON encoded context variables to pass to the Function pipeline. Takes precedence over --context-files."`
ContextFiles map[string]string `placeholder:"KEY=FILENAME;..." help:"Semicolon-separated JSON encoded context variables to pass to the Function pipeline."`
IncludeResults bool `short:"r" default:"true" help:"Include the Function's Results output."`
ObservedResources []string `short:"o" help:"A stream or directory of YAML files mocking the observed state of composed resources."`
Timeout time.Duration `help:"Amount of time to wait for the function to complete." default:"1m"`
}
Tag string `arg:"" help:"Tag of the package to be pushed. Must be a valid OCI image tag. Unqualified tags will be pushed to xpkg.upbound.io."` | ||
Package string `short:"f" help:"Path to package. If not specified and only one package exists in current directory it will be used."` |
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.
Tag string `arg:"" help:"Tag of the package to be pushed. Must be a valid OCI image tag. Unqualified tags will be pushed to xpkg.upbound.io."` | |
Package string `short:"f" help:"Path to package. If not specified and only one package exists in current directory it will be used."` | |
Tag string `arg:"" help:"Package filename and version tag to use in the container registry."` | |
Package string `short:"f" help:"Path to the Crossplane xpkg file." default:"."` |
What do you mean by "Unqualified tags"?
Ref string `arg:"" help:"The package's OCI image reference (e.g. tag)."` | ||
Name string `arg:"" optional:"" help:"Name of the package to update. Will be derived from the ref if omitted."` |
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.
Ref string `arg:"" help:"The package's OCI image reference (e.g. tag)."` | |
Name string `arg:"" optional:"" help:"Name of the package to update. Will be derived from the ref if omitted."` | |
Ref string `arg:"" help:"Package filename and version tag in the container registry."` | |
Name string `arg:"" optional:"" help:"Name of the package inside Crossplane. Derived from the package metadata name by default."` |
Ditto logout. Signed-off-by: Nic Cope <nicc@rk0n.org>
This isn't where Crossplane pulls from by default, but we think we'd like it to be someday. It's the only Crossplane-aware OCI registry we're aware of, in that packages can show up at marketplace.upbound.io decorated with docs, examples, etc. Signed-off-by: Nic Cope <nicc@rk0n.org>
I think this might have been done to avoid shadowing, but I'm not getting any linter complaints after renaming back to config. Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
This got copied from the up login implementation. We don't need or want this functionality in Crossplane. Signed-off-by: Nic Cope <nicc@rk0n.org>
This allows us to diverge from the .up config format without treading on each other. The downside is that folks using up will need to login again (even if they're using crossplane) and vice versa, but I think this is worth it. Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Unfortunately we need very copy-pasta subcommands here in order to know what type of package to install. Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
This was way less branchy to do using the controller-runtime client rather than a generated clientset, so there's quite a lot of refactoring here. As part of this commit, I also made the beta install/update command reuse the GA code. See commentary in the diff for reasoning. Signed-off-by: Nic Cope <nicc@rk0n.org>
These were internal, and appeared to only be used by the Crossplane CLI package install/update commands. Those commands now use the controller-runtime client instead. Signed-off-by: Nic Cope <nicc@rk0n.org>
I like having a little context, but prefer to keep the bulk of the detail at a URL we can update over time more easily than the CLI help strings. Signed-off-by: Nic Cope <nicc@rk0n.org>
This hopefully better explains what the flag does, while using a more generic name that is compatible with providers and functions. Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
I believe we added v2 as a temporary workaround for the fact that we had two "package build" implementations. We now only have one, that's closer to the v2 implementation. Signed-off-by: Nic Cope <nicc@rk0n.org>
It felt strange to have beta install/update variants just to handle Functions when the GA build and push commands support them. Signed-off-by: Nic Cope <nicc@rk0n.org>
This matches the prefixes of the embedded upbound.Flags, and I think it will be convenient to match the env vars used by the up CLI (where these commands originated). Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
I somewhat strongly prefer keeping the beta and alpha commands in a subdirectory:
To me
I'll be honest, I really could not stand the tree view. It was especially bad when for a while this PR had added a few more commands. I don't think it will work very well when we have ~double the amount of commands we have now. My hope is that the compact view will be a good compromise. I think it gives you all the same information as the tree view, but:
I also personally find it easier to see at a glance what the commands are when they're written as you'd copy and paste them to run - e.g. |
@plumbis I'd prefer to go in depth on documentation in a separate PR. If we get this merged today I can open a follow on to get started on some of the changes you suggested. |
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.
I'm pretty good with this major refactor and major clean-up which puts us into good position for feature freeze to continue with polish and further CLI improvements.
Biggest question is on the removal of the generated clientset stuff, please help me understand that one! 🙇♂️
@@ -58,12 +58,6 @@ limitations under the License. | |||
//go:generate go run -tags generate github.com/jmattheis/goverter/cmd/goverter -output ./apiextensions/v1/zz_generated.conversion.go -packageName v1 -packagePath=github.com/crossplane/crossplane/apis/apiextensions/v1 ./apiextensions/v1 | |||
//go:generate go run -tags generate github.com/jmattheis/goverter/cmd/goverter -output ./pkg/meta/v1alpha1/zz_generated.conversion.go -packageName v1alpha1 -packagePath=github.com/crossplane/crossplane/apis/pkg/meta/v1alpha1 ./pkg/meta/v1alpha1 | |||
|
|||
// Generate clientset for types. |
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.
I see all the clientset files getting removed in this PR too - are they just stale code that aren't used anywhere so it's time for them to go, or is it related to the CLI in some way? 🤔
Is there any announcement about their removal that needs to be included in the release notes?
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.
As far as I can tell they were only being used by the package install and update CLI commands, which now use the controller-runtime client instead. I don't think we need to announce anything. They were in the internal
package, so no one would have been able to use them before.
// initCmd initializes a new package repository from a template repository. | ||
type initCmd struct { | ||
Name string `arg:"" help:"Name of the package to initialize."` | ||
Template string `arg:"" help:"Template to initialize the package from."` |
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.
should this argument mention here that it can be a URL too? when reading the full help output i had forgotten that nuance by the time i got to this line 😅
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.
Probably yes. I tried a few times but it was tough to come up with a succinct way to do this. Mind if we add this to the list for a follow-up PR more focused on CLI help output?
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.
yep! not a blocker for me :)
@@ -1,261 +0,0 @@ | |||
/* |
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.
very cool to already clean up the xpkg/v2
temp package also - you're getting a ton of things clean in this PR @negz!! 🧹 🗑️
Description of your changes
Fixes #4787
Fixes #4784
Fixes #4783
Here's what it looks like:
Notable changes in this PR:
marketplace login
toxpkg login
xpkg build --controller
flag to--embed-runtime-image
.~/.crossplane
to avoid conflicts with~/.up
.xpkg install
, not a subcommand.xpkg init
to initialize a provider now too (or really anything - for now it's a tiny wrapper ongit clone
).I have:
Added or updated unit tests.Added or updated e2e tests, if necessary. (check with reviewers/maintainers if you're unsure whether E2E tests are necessary for the change).Runmake reviewable
to ensure this PR is ready for review.Addedbackport release-x.y
labels to auto-backport this PR, if necessary.Opened a PR updating the docs, if necessary.