-
Notifications
You must be signed in to change notification settings - Fork 244
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
Proof of concept: plugin architecture based on event bus + plugin listeners, using go-plugin #1235
Conversation
Code Climate has analyzed commit c504336 and detected 15 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
✅ odo build 1184 completed and artifacts can be found here (for commit a36c516cd6 by @metacosm) |
Codecov Report
@@ Coverage Diff @@
## master #1235 +/- ##
==========================================
- Coverage 42.53% 42.36% -0.17%
==========================================
Files 40 41 +1
Lines 5050 5136 +86
==========================================
+ Hits 2148 2176 +28
- Misses 2687 2741 +54
- Partials 215 219 +4
Continue to review full report at Codecov.
|
✅ odo build 1185 completed and artifacts can be found here (for commit 3cb62c9995 by @metacosm) |
✅ odo build 1186 completed and artifacts can be found here (for commit 6e26e38e21 by @metacosm) |
✅ odo build 1187 completed and artifacts can be found here (for commit f67647ff1a by @metacosm) |
I have a lot of questions about plugin mechanism:
My other concern is that we have quite a lot of fundamental problems mainly with interacting with S2I. |
There is no plugin system in
Binaries located in
General use case: be able to extend
As has been discussed several times already, the initial use case was supporting component CRD work without impacting the
Understood, though none of these issues are being worked on at the moment, at least, that I can see… The biggest obstacle I see right now is not moving fast enough on small things that should be done in a couple of days but are blocked by a review process that takes way too long. |
I agreed that this is not an ideal approach but on the other hand, it is easy to do, enough for a lot of use cases, and more importantly, it could mean that kubectl plugins will be compatible with odo. Which would be really nice.
I know, but how the user will install it? Are we going to guide users in the docs to copy binaries to this directory? Are we going to provide some easier mechanism like
You are very welcomed to help us solve those issues.
Agreed, but I'm afraid that adding big changes that are not properly defined beforehand are going to make things even worse. |
The only way
Could be an option, yes. You could imagine pulling a plugin from github and compiling it on the fly to install it.
That's not where my expertise lies, though, so I'm trying to help where I can help.
The point of this work (as is #1161) is to foster the discussion and see how things could work, because it's easier to reason on concrete examples than abstract ideas. Also, because restrictions might only become apparent after actually trying to implement a concept. However, if no one looks at it then it's just work for nothing. |
955407b
to
8ccf08c
Compare
✅ odo build 1291 completed and artifacts can be found here (for commit 56ca095799 by @metacosm) |
another use cases could be to :
|
8ccf08c
to
75764f7
Compare
✅ odo build 1350 completed and artifacts can be found here (for commit 792c7ac05f by @metacosm) |
75764f7
to
b7ef382
Compare
✅ odo build 1391 completed and artifacts can be found here (for commit bf5448a365 by @metacosm) |
b7ef382
to
9e1e28a
Compare
✅ odo build 1423 completed and artifacts can be found here (for commit e96682a99b by @metacosm) |
Extremely difficult to review the PR(very huge PR beyond the size I could think of for a PR ;) )... |
API is found at https://github.com/metacosm/odo-event-api. This, however, doesn't work well with vendoring so right now, both the app and plugin can only be built against an api that's in the same spot in $GOPATH. See golang/go#20481 for more details.
For some reason, need to force grpc version explicitly otherwise go-plugin won't compile. Seems like glide doesn't properly resolves the transitive dependency… :(
9e1e28a
to
c504336
Compare
✅ odo build 1587 completed and artifacts can be found here (for commit 3f1deece37 by @metacosm) |
@metacosm: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@metacosm: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
This PR as of now needs alot of work due to the major changes in odo. It would be better if a new PR using the current master is created at a later point when plugins become priority. Hence closing the PR |
What is the purpose of this change? What does it change?
This proof of concept takes the work accomplished in #1173 and changes the underlying mechanism to use hashicorp/go-plugin instead, using plain RPC.
Was the change discussed in an issue?
No.
How to test changes?
$GOPATH
(unless you know how to deal with go modules installed in$GOPATH
)git clone https://github.com/metacosm/odo-tracer-listener.git
cd odo-tracer-listener
git checkout go-plugin
go build -o tracer.listener.odo listener.go
mkdir -p ~/.odo/plugins/
(if you don't already have that dir)cp tracer.listener.odo ~/.odo/plugins/
odo
command that uses the newoc
command pattern (anyservice
,catalog
orlink/unlink
commands, only these commands are automatically wired to dispatch events)~/.odo/plugins/tracer.log
to see the logging performed by the tracer plugin.Note: It might happen that the command you issued failed with an error and you might need to check that the plugin process is not still running:
ps aux | grep tracer
and thenkillall tracer.listener.odo
. Basically, plugins are "managed" and need to be cleaned-up before the application exits. This is done by a deferred call in the mainodo
function. However, calls toos.Exit
don't run deferred functions. I have added some code to perform plugins clean up before some calls toos.Exit
but might have missed some, which might lead dangling plugin processes running (basically a server process). A proper solution to this issue will have to be devised.