mirror of
https://github.com/kemko/nomad.git
synced 2026-01-09 11:55:42 +03:00
@@ -195,6 +195,7 @@ func (a *Agent) setupClient() error {
|
||||
if a.config.Client.NetworkInterface != "" {
|
||||
conf.NetworkInterface = a.config.Client.NetworkInterface
|
||||
}
|
||||
conf.Options = a.config.Client.Options
|
||||
|
||||
// Setup the node
|
||||
conf.Node = new(structs.Node)
|
||||
|
||||
@@ -137,6 +137,12 @@ type ClientConfig struct {
|
||||
// NodeClass is used to group the node by class
|
||||
NodeClass string `hcl:"node_class"`
|
||||
|
||||
// Options is used for configuration of nomad internals,
|
||||
// like fingerprinters and drivers. The format is:
|
||||
//
|
||||
// namespace.option = value
|
||||
Options map[string]string `hcl:"options"`
|
||||
|
||||
// Metadata associated with the node
|
||||
Meta map[string]string `hcl:"meta"`
|
||||
|
||||
@@ -394,6 +400,14 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig {
|
||||
// Add the servers
|
||||
result.Servers = append(result.Servers, b.Servers...)
|
||||
|
||||
// Add the options map values
|
||||
if result.Options == nil {
|
||||
result.Options = make(map[string]string)
|
||||
}
|
||||
for k, v := range b.Options {
|
||||
result.Options[k] = v
|
||||
}
|
||||
|
||||
// Add the meta map values
|
||||
if result.Meta == nil {
|
||||
result.Meta = make(map[string]string)
|
||||
|
||||
@@ -36,6 +36,9 @@ func TestConfig_Merge(t *testing.T) {
|
||||
AllocDir: "/tmp/alloc1",
|
||||
NodeID: "node1",
|
||||
NodeClass: "class1",
|
||||
Options: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
},
|
||||
Server: &ServerConfig{
|
||||
Enabled: false,
|
||||
@@ -86,7 +89,13 @@ func TestConfig_Merge(t *testing.T) {
|
||||
NodeID: "node2",
|
||||
NodeClass: "class2",
|
||||
Servers: []string{"server2"},
|
||||
Meta: map[string]string{"baz": "zip"},
|
||||
Meta: map[string]string{
|
||||
"baz": "zip",
|
||||
},
|
||||
Options: map[string]string{
|
||||
"foo": "bar",
|
||||
"baz": "zip",
|
||||
},
|
||||
},
|
||||
Server: &ServerConfig{
|
||||
Enabled: true,
|
||||
@@ -345,6 +354,10 @@ func TestConfig_LoadConfigString(t *testing.T) {
|
||||
"foo": "bar",
|
||||
"baz": "zip",
|
||||
},
|
||||
Options: map[string]string{
|
||||
"foo": "bar",
|
||||
"baz": "zip",
|
||||
},
|
||||
},
|
||||
Server: &ServerConfig{
|
||||
Enabled: true,
|
||||
@@ -412,6 +425,10 @@ client {
|
||||
foo = "bar"
|
||||
baz = "zip"
|
||||
}
|
||||
options {
|
||||
foo = "bar"
|
||||
baz = "zip"
|
||||
}
|
||||
}
|
||||
server {
|
||||
enabled = true
|
||||
|
||||
@@ -209,6 +209,8 @@ configured on server nodes.
|
||||
is a free-form map and can contain any string values.
|
||||
* `network_interface`: This is a string to force network fingerprinting to use
|
||||
a specific network interface
|
||||
* `options`: This is a key/value mapping of internal configuration for clients,
|
||||
such as for driver configuration.
|
||||
|
||||
## Atlas Options
|
||||
|
||||
|
||||
Reference in New Issue
Block a user