Merge pull request #1201 from hashicorp/f-atlas-endpoint

Configurable Atlas endpoint
pull/1204/head
Ryan Uber 9 years ago
commit 3b3fb7f8c9

@ -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.

@ -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

@ -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"}`

@ -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,
}

@ -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",
}

@ -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

@ -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.
* <a name="_atlas_endpoint"></a><a href="#_atlas_endpoint">`-atlas-endpoint`</a> - 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.
* <a name="_bootstrap"></a><a href="#_bootstrap">`-bootstrap`</a> - 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.
* <a name="atlas_token"></a><a href="#atlas_token">`atlas_token`</a> Equivalent to the
[`-atlas-token` command-line flag](#_atlas_token).
* <a name="atlas_endpoint"></a><a href="#atlas_endpoint">`atlas_endpoint`</a> Equivalent to the
[`-atlas-endpoint` command-line flag](#_atlas_endpoint).
* <a name="bootstrap"></a><a href="#bootstrap">`bootstrap`</a> 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

Loading…
Cancel
Save