-
Notifications
You must be signed in to change notification settings - Fork 262
[WIP] Add Application plugin and Event repeater #474
base: master
Are you sure you want to change the base?
Conversation
@chungers I want to show you my image with a working code. Of cource I will add tests and documents! |
Codecov Report
@@ Coverage Diff @@
## master #474 +/- ##
==========================================
+ Coverage 56.56% 57.35% +0.78%
==========================================
Files 57 57
Lines 3928 3782 -146
==========================================
- Hits 2222 2169 -53
+ Misses 1420 1334 -86
+ Partials 286 279 -7
Continue to review full report at Codecov.
|
@YujiOshima - nice work! Can you add some docs on the use of MQTT? Also let's add some tests... There's a |
pkg/spi/application/types.go
Outdated
UPDATE | ||
// GET resources | ||
GET | ||
) |
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 comments:
-
This SPI is pretty generic... are you intending for this to be a way to do generic CRUD operations on objects? This makes me think about TPR in k8s: https://kubernetes.io/docs/concepts/ecosystem/thirdpartyresource/
-
What are objects that we are doing CRUD operations on? Do you mean something like a group Spec or an instance Spec or something that maps to our plugin objects? For example, if I wanted to let a developer write an application that can control its own node scaling, can we expose the Group spec as an object and let the user call this API to update the Group spec (e.g. changing the number of nodes)?
-
I think this should be a RESTful API listening on a port and not another JSON-RPC plugin interface. This is so that this becomes a general API (and not an SPI) which can be easily consumed by any application. So you could deploy a web application that will automatically scale up and down the number of nodes and do rolling update when the application itself detects a new version is available. Make sense?
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.
are you intending for this to be a way to do generic CRUD operations on objects?
Yes. Since application has not been defined for a specific purpose, we think that it needs a general interface.
What are objects that we are doing CRUD operations on?
Although it is sufficient to think of handling Group specs, it is not clear what kinds of objects to handle at the moment. Because the purpose of application is not specific.
If it is limited to Group spec, instance Spec, implementation of event repeater becomes complicated
For that reason, we are currently setting it as a simple json object, of course GroupSpec could also be passed as a json object.
I think this should be a RESTful API listening on a port
So you could deploy a web application …
As you say, I think the Restful interface is useful.
In my understanding, Is the infrakit application to connect deployed app (not infrakit app, app on docker cluster) and Infrakit flavor and instance plugin for autoscale and rolling update?
If so it is quite consistent with my opinion.
I'd like to implement it as the next Infarakit application.
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 non-trivial example of an infrakit 'application' that I have in mind is a small daemon that listens on a tcp port, offers a RESTful api that makes it easy for infrakit to implement this:
https://github.com/kubernetes/contrib/blob/master/cluster-autoscaler/cloudprovider/cloud_provider.go#L40
So if you look at it this way, we need to have a way to give an imperative API to infrakit's inherently declarative based api (via only a verb commit
). We don't really need to add more plugin spi / JSON RPC implementations... instead the 'application' can surface our internal plugin SPI in a meaningful way to other systems.
So let's chat at DockerCon more in detail about this idea. We need to take time to get this right.
@YujiOshima - thank you for taking the lead on this. Let's leave this PR / branch open and refine it. I think you're onto something very cool. My initial thinking when we talked about this was not very refined, but seeing your POC has gotten me thinking about a general API. Can you have a look at my questions and lets discuss more. Thank you! |
@chungers Thankyou for your comments! |
Signed-off-by: Yuji Oshima <[email protected]>
Signed-off-by: Yuji Oshima <[email protected]>
Signed-off-by: Yuji Oshima <[email protected]>
Signed-off-by: Yuji Oshima <[email protected]>
Signed-off-by: Yuji Oshima <[email protected]>
Signed-off-by: Yuji Oshima <[email protected]>
Signed-off-by: YujiOshima <[email protected]>
Signed-off-by: YujiOshima <[email protected]>
Signed-off-by: YujiOshima <[email protected]>
Hi @chungers ! I added tests and moved commands to under util. |
@YujiOshima - can you sync and update this PR? Sorry the cmd/cli directory has been renamed to cmd/infrakit plus a few fixes. I will take a look at your README. Thank you! |
Signed-off-by: YujiOshima <[email protected]>
Signed-off-by: YujiOshima <[email protected]>
Signed-off-by: YujiOshima <[email protected]>
@chungers Thanks! This PR is now up to date ! |
I get the event repeater but I am little confused by the usage of the If the |
@chungers Thank you for review. I understand you said and I agree that is more reasonable about event-repeater. |
Signed-off-by: YujiOshima <[email protected]>
…t-repeater command Signed-off-by: YujiOshima <[email protected]>
Signed-off-by: YujiOshima <[email protected]>
@chungers I integrated two commands to event-repater command. |
Please sign your commits following these rules: $ git clone -b "evrepeater" [email protected]:YujiOshima/infrakit.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354568776
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f Amending updates the existing PR. You DO NOT need to open a new one. |
* Updated the Docker for AWS docs, to include new parameters, and remove private beta stuff * Change the crontab for prune job to once per day instead of once per hour Signed-off-by: Ken Cochrane <[email protected]> * cleaned up comments from friism Signed-off-by: Ken Cochrane <[email protected]>
* Updated the Docker for AWS docs, to include new parameters, and remove private beta stuff * Change the crontab for prune job to once per day instead of once per hour Signed-off-by: Ken Cochrane <[email protected]> * cleaned up comments from friism Signed-off-by: Ken Cochrane <[email protected]>
Hi @YujiOshima - Let's discuss this PR. I think now that we have some useful patterns in terms of controllers vs. plugins, we should revisit this. I am thinking of the recent example of an |
This PR add concept of application plugin. ( Related #435 )
Infrakit 'app' is an application that can talk to the infrakit plugins using the plugin api but itself listens on a port and offers a REST api for operations.
An example of App is Event repeater.
It is subscribe event plugin and publish the messages to other protocol brocker(e.g. mqtt).
** Get Start
*** Prepare
Start event plugin and mqtt broker
*** Run event repeater
Now your app connected to event plugin and mqtt broker.
If you set
—-allowall
, your app subscribe ‘.’ Topic from event and publish all events to broker with original topic.You can specify repeat topics with infrakit command like below.
Events are described json style.
Then you can delete registerd event.