Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit 6ff1e3a

Browse files
authored
Add a blurb about creating a new plugin (#313)
Signed-off-by: Bill Farner <[email protected]>
1 parent 8ff3bf5 commit 6ff1e3a

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

docs/plugins/README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
Much of the behavior in _InfraKit_ is defined by Plugins. Technically, a Plugin is an HTTP server with a well-defined
44
API, listening on a unix socket.
55

6-
[Utilities](pkg/rpc) are available as libraries to simplify Plugin development in Go.
7-
86
## Plugin Discovery
97

108
Multiple _InfraKit_ plugins are typically used together to support a declared configuration. These plugins discover
@@ -82,14 +80,14 @@ Over time, we would prefer to phase out reference Plugins that appear to provide
8280
are developed independently. For this reason, please [file an issue](https://github.com/docker/infrakit/issues/new)
8381
to start a discussion before contributing to these plugins with non-trivial code.
8482

85-
| plugin | type | description |
86-
|:---------------------------------------------------|:---------|:----------------------------------------|
87-
| [swarm](pkg/example/flavor/swarm) | flavor | runs Docker in Swarm mode |
88-
| [vanilla](pkg/example/flavor/vanilla) | flavor | manual specification of instance fields |
89-
| [zookeeper](pkg/example/flavor/zookeeper) | flavor | run an Apache ZooKeeper ensemble |
90-
| [infrakit/file](pkg/example/instance/file) | instance | useful for development and testing |
91-
| [infrakit/terraform](pkg/example/instance/terraform) | instance | creates instances using Terraform |
92-
| [infrakit/vagrant](pkg/example/instance/vagrant) | instance | creates Vagrant VMs |
83+
| plugin | type | description |
84+
|:-----------------------------------------------------|:---------|:----------------------------------------|
85+
| [swarm](pkg/example/flavor/swarm) | flavor | runs Docker in Swarm mode |
86+
| [vanilla](pkg/example/flavor/vanilla) | flavor | manual specification of instance fields |
87+
| [zookeeper](pkg/example/flavor/zookeeper) | flavor | run an Apache ZooKeeper ensemble |
88+
| [infrakit/file](pkg/example/instance/file) | instance | useful for development and testing |
89+
| [infrakit/terraform](pkg/example/instance/terraform) | instance | creates instances using Terraform |
90+
| [infrakit/vagrant](pkg/example/instance/vagrant) | instance | creates Vagrant VMs |
9391

9492

9593
### Supported implementations
@@ -103,14 +101,20 @@ project, so please double-check where the code lives before filing InfraKit issu
103101

104102
Have a Plugin you'd like to share? Submit a Pull Request to add yourself to the list!
105103

106-
### APIs
104+
### Creating a plugin
105+
A plugin must be an HTTP server that implements one of the plugin [APIs](#apis), lisetning on a Unix socket. While
106+
a plugin can be written in any programming language, [utilities](pkg/rpc) are available as libraries to simplify Plugin
107+
development in Go. Our [reference implementations](#reference-implementations) should provide a good starting point
108+
for building a new plugin using these utilities.
109+
110+
#### APIs
107111
_InfraKit_ plugins are exposed via HTTP, using [JSON-RPC 2.0](http://www.jsonrpc.org/specification).
108112

109113
API requests can be made manually with `curl`. For example, the following command will list all groups:
110114
```console
111115
$ curl -X POST --unix-socket ~/.infrakit/plugins/group http:/rpc \
112116
-H 'Content-Type: application/json'
113-
-d '{"jsonrpc":"2.0","method":"Group.InspectGroups","params":{},"id":5577006791947779410}'
117+
-d '{"jsonrpc":"2.0","method":"Group.InspectGroups","params":{},"id":1}'
114118
{"jsonrpc":"2.0","result":{"Groups":null},"id":1}
115119
```
116120

0 commit comments

Comments
 (0)