mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
plugins/drivers: nil gaurd driver config when building executor config
This commit is contained in:
@@ -17,6 +17,16 @@ import (
|
||||
"github.com/hashicorp/nomad/plugins/base"
|
||||
)
|
||||
|
||||
const (
|
||||
// ExecutorDefaultMaxPort is the default max port used by the executor for
|
||||
// searching for an available port
|
||||
ExecutorDefaultMaxPort = 14512
|
||||
|
||||
// ExecutorDefaultMinPort is the default min port used by the executor for
|
||||
// searching for an available port
|
||||
ExecutorDefaultMinPort = 14000
|
||||
)
|
||||
|
||||
// CgroupsMounted returns true if the cgroups are mounted on a system otherwise
|
||||
// returns false
|
||||
func CgroupsMounted(node *structs.Node) bool {
|
||||
@@ -26,7 +36,7 @@ func CgroupsMounted(node *structs.Node) bool {
|
||||
|
||||
// CreateExecutor launches an executor plugin and returns an instance of the
|
||||
// Executor interface
|
||||
func CreateExecutor(w io.Writer, level hclog.Level, nomadConfig *base.ClientDriverConfig,
|
||||
func CreateExecutor(w io.Writer, level hclog.Level, driverConfig *base.ClientDriverConfig,
|
||||
executorConfig *dstructs.ExecutorConfig) (executor.Executor, *plugin.Client, error) {
|
||||
|
||||
c, err := json.Marshal(executorConfig)
|
||||
@@ -44,8 +54,13 @@ func CreateExecutor(w io.Writer, level hclog.Level, nomadConfig *base.ClientDriv
|
||||
config.HandshakeConfig = driver.HandshakeConfig
|
||||
config.Plugins = driver.GetPluginMap(w, level, executorConfig.FSIsolation)
|
||||
|
||||
config.MaxPort = nomadConfig.ClientMaxPort
|
||||
config.MinPort = nomadConfig.ClientMinPort
|
||||
if driverConfig != nil {
|
||||
config.MaxPort = driverConfig.ClientMaxPort
|
||||
config.MinPort = driverConfig.ClientMinPort
|
||||
} else {
|
||||
config.MaxPort = ExecutorDefaultMaxPort
|
||||
config.MinPort = ExecutorDefaultMinPort
|
||||
}
|
||||
|
||||
// setting the setsid of the plugin process so that it doesn't get signals sent to
|
||||
// the nomad client.
|
||||
|
||||
Reference in New Issue
Block a user