-
Notifications
You must be signed in to change notification settings - Fork 593
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 plugin support #1519
Add plugin support #1519
Conversation
can really be deleted :) - we wrote those when we were testing things a while ago and don't need them any more. |
tip-top!
this is a beautiful start. minor nits on os.execlpe() rather than os.cmd() |
@twmb i wonder if we can create a plugin for wow so many goodies here. probably one for
very freeing this thing. |
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.
Good job. Comments inline.
@twmb - make sure you approve this cla |
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.
lgtm
|
Ahhh that is likely from 367410a. I thought this may happen while making that change. I wonder if it's possible to support the commit and fix the build, otherwise I'm happy to delete this GOOS / GOPATH change. |
taskfiles/rpk.yml
Outdated
@@ -6,8 +6,6 @@ tasks: | |||
vars: | |||
RPK_VERSION: '{{default "latest" .TAG_NAME}}' | |||
env: | |||
GOOS: '{{OS | lower}}' |
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.
this change seems unrelated to adding plugin support IMO.
ok to have, but probably makes sense to have a separate PR for this. We'll need @ivotron 's thoughts on this. I think on the build machines you have multiple go packages installed (or we used to)
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.
It was something I ran into while adding the taskfile
mod tidy bit brought up in an earlier comment; I've dropped it from this PR. If possible, I do think this is worth revisiting.
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.
we currently don't build for multiple OSs using taskfiles, so we could drop it. We just need to update the places that assume $GOOS is in the path, which is mainly our packaging tools
@@ -20,3 +20,10 @@ tasks: | |||
-X ${ver_pkg}.rev={{.SHORT_SHA}} \ | |||
-X ${cont_pkg}.tag={{.RPK_VERSION}}" \ | |||
-o "{{.BUILD_ROOT}}/go/$GOOS/bin" ./... | |||
tidy: |
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 nice!
@@ -511,6 +511,7 @@ github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxd | |||
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= | |||
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= | |||
github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= | |||
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= |
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 making this a separate commit. makes it easy to read.
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.
this looks good to me. In the future, please keep a PR focused on one set of changes. ok to leave the go os removal for now on this one.
I've dropped the GOOS removal, should allow the build to pass in this PR and drops one unrelated aspect. I've kept the |
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.
LGTM
For any dir under src/go, this will cd into it and run `go mod tidy`
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.
This is awesome! Left a few minor comments.
args = append([]string{path}, args...) | ||
env := os.Environ() | ||
if runtime.GOOS == "windows" { | ||
return (&exec.Cmd{ |
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.
Is this for WSL2?
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.
This is just for Windows in general. I don't think redpanda is supported on Windows, but a client should be able to connect from Windows to get the status, and an exec like this can support a module on Windows as well.
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 reason I was asking is that we don't build for windows right now, so even though this is nice, it won't be used.
`cmd` is usually next to `pkg`, to separate binaries from libraries.
Quote, """ * groupcsaw * kverify can really be deleted :) - we wrote those when we were testing things a while ago and don't need them any more. """
This follows the exact algorithm that is used in kubernetes for plugins; a followup PR will introduce a `plugin list` subcommand that will behavior similarly to kubernetes as well. Plugin support is fairly simple; the test is a bit overkill. Unlike kubernetes, I'd like to bundle in plugin search directly into rpk, rather than eschew responsibility to a separate command (krew). That can also be done as followup.
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.
@twmb - great work!
@graphcareful - the rpk wasm lsit
should use this plugin approach. - though, we have to teach vtools to package them.
Add plugin support
Add plugin support
Cover letter
This adds support for rpk to execute plugins, following the exact logic that kubernetes has, as documented here.
Followup PRs will be issued to add
rpk plugin list
, as well as plugin discovery.list
will be easy and will again follow the same logic that kubernetes has, but discovery will be a good bit more difficult.