mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
executors: Unify go-plugin handshake
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
hclog "github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-plugin"
|
||||
|
||||
"github.com/hashicorp/nomad/plugins/base"
|
||||
"github.com/hashicorp/nomad/plugins/executor"
|
||||
)
|
||||
|
||||
@@ -42,7 +43,7 @@ func (e *ExecutorPluginCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
plugin.Serve(&plugin.ServeConfig{
|
||||
HandshakeConfig: executor.HandshakeConfig,
|
||||
HandshakeConfig: base.Handshake,
|
||||
Plugins: executor.GetPluginMap(
|
||||
stdo,
|
||||
hclog.LevelFromString(executorConfig.LogLevel),
|
||||
|
||||
@@ -78,7 +78,7 @@ func CreateExecutor(w io.Writer, level hclog.Level, driverConfig *base.ClientDri
|
||||
config := &plugin.ClientConfig{
|
||||
Cmd: exec.Command(bin, "executor", string(c)),
|
||||
}
|
||||
config.HandshakeConfig = pexecutor.HandshakeConfig
|
||||
config.HandshakeConfig = base.Handshake
|
||||
config.Plugins = pexecutor.GetPluginMap(w, level, executorConfig.FSIsolation)
|
||||
|
||||
if driverConfig != nil {
|
||||
@@ -111,7 +111,7 @@ func CreateExecutor(w io.Writer, level hclog.Level, driverConfig *base.ClientDri
|
||||
|
||||
// CreateExecutorWithConfig launches a plugin with a given plugin config
|
||||
func CreateExecutorWithConfig(config *plugin.ClientConfig, w io.Writer) (executor.Executor, *plugin.Client, error) {
|
||||
config.HandshakeConfig = pexecutor.HandshakeConfig
|
||||
config.HandshakeConfig = base.Handshake
|
||||
|
||||
// Setting this to DEBUG since the log level at the executor server process
|
||||
// is already set, and this effects only the executor client.
|
||||
|
||||
@@ -22,12 +22,6 @@ type ExecutorConfig struct {
|
||||
FSIsolation bool
|
||||
}
|
||||
|
||||
var HandshakeConfig = plugin.HandshakeConfig{
|
||||
ProtocolVersion: 1,
|
||||
MagicCookieKey: "NOMAD_PLUGIN_MAGIC_COOKIE",
|
||||
MagicCookieValue: "e4327c2e01eabfd75a8a67adb114fb34a757d57eee7728d857a8cec6e91a7255",
|
||||
}
|
||||
|
||||
func GetPluginMap(w io.Writer, logLevel hclog.Level, fsIsolation bool) map[string]plugin.Plugin {
|
||||
e := new(ExecutorPlugin)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user