docker: properly launch docker logger process

This commit is contained in:
Nick Ethier
2018-11-06 00:39:00 -05:00
parent a1d5f127e3
commit 9d8d3e158a
3 changed files with 51 additions and 5 deletions

View File

@@ -0,0 +1,36 @@
package command
import (
"strings"
hclog "github.com/hashicorp/go-hclog"
plugin "github.com/hashicorp/go-plugin"
"github.com/hashicorp/nomad/drivers/docker/docklog"
"github.com/hashicorp/nomad/plugins/base"
)
type DockerLoggerPluginCommand struct {
Meta
}
func (e *DockerLoggerPluginCommand) Help() string {
helpText := `
This is a command used by Nomad internally to launch the docker logger process"
`
return strings.TrimSpace(helpText)
}
func (e *DockerLoggerPluginCommand) Synopsis() string {
return "internal - launch a docker logger plugin"
}
func (e *DockerLoggerPluginCommand) Run(args []string) int {
plugin.Serve(&plugin.ServeConfig{
HandshakeConfig: base.Handshake,
Plugins: map[string]plugin.Plugin{
docklog.PluginName: docklog.NewPlugin(docklog.NewDockerLogger(hclog.Default().Named(docklog.PluginName))),
},
GRPCServer: plugin.DefaultGRPCServer,
})
return 0
}