From 1cc2429364cdfd76b23695cd3f439e8e45cee983 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Thu, 27 Aug 2015 11:08:01 -0700 Subject: [PATCH 1/4] agent: atlas_endpoint is configurable --- command/agent/config.go | 7 +++++++ command/agent/config_test.go | 11 ++++++++++- command/agent/scada.go | 1 + command/agent/scada_test.go | 2 ++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/command/agent/config.go b/command/agent/config.go index 5b3357a34e..f0aba4247f 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -363,6 +363,10 @@ type Config struct { // to it's cluster. Requires Atlas integration. AtlasJoin bool `mapstructure:"atlas_join"` + // AtlasEndpoint is the SCADA endpoint used for Atlas integration. If + // empty, the defaults from the provider are used. + AtlasEndpoint string `mapstructure:"atlas_endpoint"` + // AEInterval controls the anti-entropy interval. This is how often // the agent attempts to reconcile it's local state with the server' // representation of our state. Defaults to every 60s. @@ -1056,6 +1060,9 @@ func MergeConfig(a, b *Config) *Config { if b.AtlasJoin { result.AtlasJoin = true } + if b.AtlasEndpoint != "" { + result.AtlasEndpoint = b.AtlasEndpoint + } if b.SessionTTLMinRaw != "" { result.SessionTTLMin = b.SessionTTLMin result.SessionTTLMinRaw = b.SessionTTLMinRaw diff --git a/command/agent/config_test.go b/command/agent/config_test.go index ed2a2921e0..37e0cf27dd 100644 --- a/command/agent/config_test.go +++ b/command/agent/config_test.go @@ -706,7 +706,13 @@ func TestDecodeConfig(t *testing.T) { } // Atlas configs - input = `{"atlas_infrastructure": "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, + "atlas_endpoint": "foo.bar:1111" +}` config, err = DecodeConfig(bytes.NewReader([]byte(input))) if err != nil { t.Fatalf("err: %s", err) @@ -724,6 +730,9 @@ func TestDecodeConfig(t *testing.T) { if !config.AtlasJoin { t.Fatalf("bad: %#v", config) } + if config.AtlasEndpoint != "foo.bar:1111" { + t.Fatalf("bad: %#v", config) + } // SessionTTLMin input = `{"session_ttl_min": "5s"}` diff --git a/command/agent/scada.go b/command/agent/scada.go index 2fd3d543d9..7cd69e0238 100644 --- a/command/agent/scada.go +++ b/command/agent/scada.go @@ -47,6 +47,7 @@ func ProviderConfig(c *Config) *client.ProviderConfig { Handlers: map[string]client.CapabilityProvider{ "http": nil, }, + Endpoint: c.AtlasEndpoint, ResourceGroup: c.AtlasInfrastructure, Token: c.AtlasToken, } diff --git a/command/agent/scada_test.go b/command/agent/scada_test.go index e142f54ae5..bdd52be6e2 100644 --- a/command/agent/scada_test.go +++ b/command/agent/scada_test.go @@ -43,6 +43,7 @@ func TestProviderConfig(t *testing.T) { conf.Server = true conf.AtlasInfrastructure = "armon/test" conf.AtlasToken = "foobarbaz" + conf.AtlasEndpoint = "foo.bar:1111" pc := ProviderConfig(conf) expect := &client.ProviderConfig{ @@ -62,6 +63,7 @@ func TestProviderConfig(t *testing.T) { Handlers: map[string]client.CapabilityProvider{ "http": nil, }, + Endpoint: "foo.bar:1111", ResourceGroup: "armon/test", Token: "foobarbaz", } From c468acf222a46b7d27c6a5a661ace4587fa593c0 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Thu, 27 Aug 2015 11:11:05 -0700 Subject: [PATCH 2/4] command: atlas endpoint can be passed --- command/agent/command.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/command/agent/command.go b/command/agent/command.go index 4805345895..b656021935 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -87,6 +87,7 @@ func (c *Command) readConfig() *Config { 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") + cmdFlags.StringVar(&cmdConfig.AtlasEndpoint, "atlas-endpoint", "", "endpoint for Atlas integration") cmdFlags.IntVar(&cmdConfig.Protocol, "protocol", -1, "protocol version") @@ -962,6 +963,7 @@ Options: -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 + -atlas-endpoint=1.2.3.4 The address of the endpoint for Atlas integration. -bootstrap Sets server to bootstrap mode -bind=0.0.0.0 Sets the bind address for cluster communication -bootstrap-expect=0 Sets server to expect bootstrap mode. From 692e9078cb5802f1b960e276fa558d6bf6653a4e Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Thu, 27 Aug 2015 11:29:42 -0700 Subject: [PATCH 3/4] website: rebundle --- website/Gemfile.lock | 64 ++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/website/Gemfile.lock b/website/Gemfile.lock index 9477360f6c..c9d4cb9752 100644 --- a/website/Gemfile.lock +++ b/website/Gemfile.lock @@ -21,21 +21,25 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.1.12) - i18n (~> 0.6, >= 0.6.9) + activesupport (4.2.4) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - autoprefixer-rails (5.2.1) + autoprefixer-rails (5.2.1.3) execjs json bootstrap-sass (3.3.5.1) autoprefixer-rails (>= 5.0.0.1) sass (>= 3.3.0) builder (3.2.2) - celluloid (0.16.0) - timers (~> 4.0.0) + capybara (2.4.4) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) chunky_png (1.3.4) coffee-script (2.4.1) coffee-script-source @@ -59,16 +63,15 @@ GEM eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) erubis (2.7.0) - eventmachine (1.0.7) - execjs (2.5.2) + eventmachine (1.0.8) + execjs (2.6.0) ffi (1.9.10) git-version-bump (0.15.1) - haml (4.0.6) + haml (4.0.7) tilt hike (1.2.3) - hitimes (1.2.2) - hooks (0.4.0) - uber (~> 0.0.4) + hooks (0.4.1) + uber (~> 0.0.14) htmlcompressor (0.2.0) http_parser.rb (0.6.0) i18n (0.7.0) @@ -77,34 +80,33 @@ GEM less (2.6.0) commonjs (~> 0.2.7) libv8 (3.16.14.11) - listen (2.10.1) - celluloid (~> 0.16.0) + listen (3.0.3) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) - middleman (3.3.13) + middleman (3.4.0) coffee-script (~> 2.2) compass (>= 1.0.0, < 2.0.0) compass-import-once (= 1.0.5) execjs (~> 2.0) haml (>= 4.0.5) kramdown (~> 1.2) - middleman-core (= 3.3.13) + middleman-core (= 3.4.0) middleman-sprockets (>= 3.1.2) sass (>= 3.4.0, < 4.0) uglifier (~> 2.5) - middleman-core (3.3.13) - activesupport (~> 4.1.0) + middleman-core (3.4.0) + activesupport (~> 4.1) bundler (~> 1.1) + capybara (~> 2.4.4) erubis hooks (~> 0.3) i18n (~> 0.7.0) - listen (>= 2.7.9, < 3.0) + listen (~> 3.0.3) padrino-helpers (~> 0.12.3) rack (>= 1.4.5, < 2.0) - rack-test (~> 0.6.2) thor (>= 0.15.2, < 2.0) tilt (~> 1.4.1, < 2.0) - middleman-livereload (3.4.2) + middleman-livereload (3.4.3) em-websocket (~> 0.5.1) middleman-core (>= 3.3) rack-livereload (~> 0.3.15) @@ -119,8 +121,12 @@ GEM middleman-syntax (2.0.0) middleman-core (~> 3.2) rouge (~> 1.0) - minitest (5.7.0) + mime-types (2.6.1) + mini_portile (0.6.2) + minitest (5.8.0) multi_json (1.11.2) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) padrino-helpers (0.12.5) i18n (~> 0.6, >= 0.6.7) padrino-support (= 0.12.5) @@ -128,7 +134,7 @@ GEM padrino-support (0.12.5) activesupport (>= 3.1) rack (1.6.4) - rack-contrib (1.3.0) + rack-contrib (1.4.0) git-version-bump (~> 0.15) rack (~> 1.4) rack-livereload (0.3.16) @@ -136,7 +142,7 @@ GEM rack-protection (1.5.3) rack rack-rewrite (1.5.1) - rack-ssl-enforcer (0.2.8) + rack-ssl-enforcer (0.2.9) rack-test (0.6.3) rack (>= 1.0) rb-fsevent (0.9.5) @@ -145,7 +151,7 @@ GEM redcarpet (3.3.2) ref (2.0.0) rouge (1.9.1) - sass (3.4.16) + sass (3.4.18) sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) @@ -166,14 +172,14 @@ GEM thor (0.19.1) thread_safe (0.3.5) tilt (1.4.1) - timers (4.0.1) - hitimes tzinfo (1.2.2) thread_safe (~> 0.1) - uber (0.0.13) - uglifier (2.7.1) + uber (0.0.14) + uglifier (2.7.2) execjs (>= 0.3.0) json (>= 1.8.0) + xpath (2.0.0) + nokogiri (~> 1.3) PLATFORMS ruby From b8e82eee1cb5c488362d866a797618bcca1aba93 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Thu, 27 Aug 2015 11:31:29 -0700 Subject: [PATCH 4/4] website: document atlas endpoint config --- website/source/docs/agent/options.html.markdown | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/website/source/docs/agent/options.html.markdown b/website/source/docs/agent/options.html.markdown index e014dea043..ba9c526e10 100644 --- a/website/source/docs/agent/options.html.markdown +++ b/website/source/docs/agent/options.html.markdown @@ -63,6 +63,11 @@ The options below are all specified on the command-line. API authentication token. This can also be provided using the `ATLAS_TOKEN` environment variable. Required for use with Atlas. +* `-atlas-endpoint` - The endpoint + address used for Atlas integration. Used only if the `-atlas` and + `-atlas-token` options are specified. This is optional, and defaults to the + public Atlas endpoints. + * `-bootstrap` - This flag is used to control if a server is in "bootstrap" mode. It is important that no more than one server *per* datacenter be running in this mode. Technically, a server in bootstrap mode @@ -351,6 +356,9 @@ definitions support being updated during a reload. * `atlas_token` Equivalent to the [`-atlas-token` command-line flag](#_atlas_token). +* `atlas_endpoint` Equivalent to the + [`-atlas-endpoint` command-line flag](#_atlas_endpoint). + * `bootstrap` Equivalent to the [`-bootstrap` command-line flag](#_bootstrap). @@ -645,3 +653,4 @@ items which are reloaded include: * HTTP Client Address * Atlas Token * Atlas Infrastructure +* Atlas Endpoint