mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 19:35:41 +03:00
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:
18
plugins/device/cmd/example/cmd/main.go
Normal file
18
plugins/device/cmd/example/cmd/main.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user