diff --git a/command/agent/command.go b/command/agent/command.go index 2f64782061..b1da6751ec 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -78,7 +78,7 @@ func (c *Command) readConfig() *Config { cmdFlags.StringVar(&cmdConfig.BindAddr, "bind", "", "address to bind server listeners to") cmdFlags.StringVar(&cmdConfig.AdvertiseAddr, "advertise", "", "address to advertise instead of bind addr") - cmdFlags.StringVar(&cmdConfig.AtlasCluster, "atlas-cluster", "", "cluster name in Atlas") + cmdFlags.StringVar(&cmdConfig.AtlasInfrastructure, "atlas", "", "infrastructure name in Atlas") cmdFlags.StringVar(&cmdConfig.AtlasToken, "atlas-token", "", "authentication token for Atlas") cmdFlags.BoolVar(&cmdConfig.AtlasJoin, "atlas-join", false, "auto-join with Atlas") @@ -335,7 +335,7 @@ func (c *Command) setupAgent(config *Config, logOutput io.Writer, logWriter *log // Enable the SCADA integration var scadaList net.Listener - if config.AtlasCluster != "" { + if config.AtlasInfrastructure != "" { provider, list, err := NewProvider(config, logOutput) if err != nil { agent.Shutdown() @@ -649,9 +649,9 @@ func (c *Command) Run(args []string) int { } // Determine the Atlas cluster - cluster := config.AtlasCluster - if cluster == "" { - cluster = "" + atlas := "" + if config.AtlasInfrastructure != "" { + atlas = fmt.Sprintf("(Infrastructure: '%s' Join: %v)", config.AtlasInfrastructure, config.AtlasJoin) } // Let the agent know we've finished registration @@ -667,7 +667,7 @@ func (c *Command) Run(args []string) int { config.Ports.SerfLan, config.Ports.SerfWan)) c.Ui.Info(fmt.Sprintf("Gossip encrypt: %v, RPC-TLS: %v, TLS-Incoming: %v", gossipEncrypted, config.VerifyOutgoing, config.VerifyIncoming)) - c.Ui.Info(fmt.Sprintf(" Atlas Cluster: %v", cluster)) + c.Ui.Info(fmt.Sprintf(" Atlas: %s", atlas)) // Enable log streaming c.Ui.Info("") @@ -842,7 +842,7 @@ Usage: consul agent [options] Options: -advertise=addr Sets the advertise address to use - -atlas-cluster=org/name Sets the Atlas cluster name, enables SCADA. + -atlas=org/name Sets the Atlas infrastructure name, enables SCADA. -atlas-join Enables auto-joining the Atlas cluster -atlas-token=token Provides the Atlas API token -bootstrap Sets server to bootstrap mode diff --git a/command/agent/config.go b/command/agent/config.go index f3c237dcbb..38490a919b 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -318,8 +318,8 @@ type Config struct { // HTTPAPIResponseHeaders are used to add HTTP header response fields to the HTTP API responses. HTTPAPIResponseHeaders map[string]string `mapstructure:"http_api_response_headers"` - // AtlasCluster is the name of the cluster we belong to. e.g. hashicorp/stage - AtlasCluster string `mapstructure:"atlas_cluster"` + // AtlasInfrastructure is the name of the infrastructure we belong to. e.g. hashicorp/stage + AtlasInfrastructure string `mapstructure:"atlas_infrastructure"` // AtlasToken is our authentication token from Atlas AtlasToken string `mapstructure:"atlas_token"` @@ -958,8 +958,8 @@ func MergeConfig(a, b *Config) *Config { if b.UnixSockets.Perms != "" { result.UnixSockets.Perms = b.UnixSockets.Perms } - if b.AtlasCluster != "" { - result.AtlasCluster = b.AtlasCluster + if b.AtlasInfrastructure != "" { + result.AtlasInfrastructure = b.AtlasInfrastructure } if b.AtlasToken != "" { result.AtlasToken = b.AtlasToken diff --git a/command/agent/config_test.go b/command/agent/config_test.go index 5e7f254ed0..b6cdac2055 100644 --- a/command/agent/config_test.go +++ b/command/agent/config_test.go @@ -635,13 +635,13 @@ func TestDecodeConfig(t *testing.T) { } // Atlas configs - input = `{"atlas_cluster": "hashicorp/prod", "atlas_token": "abcdefg", "atlas_acl_token": "123456789", "atlas_join": true}` + input = `{"atlas_infrastructure": "hashicorp/prod", "atlas_token": "abcdefg", "atlas_acl_token": "123456789", "atlas_join": true}` config, err = DecodeConfig(bytes.NewReader([]byte(input))) if err != nil { t.Fatalf("err: %s", err) } - if config.AtlasCluster != "hashicorp/prod" { + if config.AtlasInfrastructure != "hashicorp/prod" { t.Fatalf("bad: %#v", config) } if config.AtlasToken != "abcdefg" { @@ -1116,10 +1116,10 @@ func TestMergeConfig(t *testing.T) { Perms: "0700", }, }, - AtlasCluster: "hashicorp/prod", - AtlasToken: "123456789", - AtlasACLToken: "abcdefgh", - AtlasJoin: true, + AtlasInfrastructure: "hashicorp/prod", + AtlasToken: "123456789", + AtlasACLToken: "abcdefgh", + AtlasJoin: true, } c := MergeConfig(a, b) diff --git a/command/agent/scada.go b/command/agent/scada.go index 7fb8c42f9f..1805611a22 100644 --- a/command/agent/scada.go +++ b/command/agent/scada.go @@ -47,7 +47,7 @@ func ProviderConfig(c *Config) *client.ProviderConfig { Handlers: map[string]client.CapabilityProvider{ "http": nil, }, - ResourceGroup: c.AtlasCluster, + ResourceGroup: c.AtlasInfrastructure, Token: c.AtlasToken, } } @@ -67,7 +67,7 @@ func NewProvider(c *Config, logOutput io.Writer) (*client.Provider, net.Listener // TODO: AtlasACLToken // Create an HTTP listener and handler - list := newScadaListener(c.AtlasCluster) + list := newScadaListener(c.AtlasInfrastructure) config.Handlers["http"] = func(capability string, meta map[string]string, conn io.ReadWriteCloser) error { return list.PushRWC(conn)