Example device plugin and helpers

This PR introduces:
* An example device plugin that exposes files as devices for testing.
* Helpers for serving a device plugin
* A launcher binary that allows interacting with a device plugin without
needing a Nomad client.
This commit is contained in:
Alex Dadgar
2018-08-17 15:19:44 -07:00
parent 5f03921a46
commit a0b01d16c6
12 changed files with 926 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
package main
import (
log "github.com/hashicorp/go-hclog"
"github.com/hashicorp/nomad/plugins"
"github.com/hashicorp/nomad/plugins/device/cmd/example"
)
func main() {
// Serve the plugin
plugins.Serve(factory)
}
// factory returns a new instance of our example device plugin
func factory(log log.Logger) interface{} {
return example.NewExampleDevice(log)
}