Sean Chittenden
bcbec34937
Only actively test Consul when env CONSUL_HTTP_ADDR
is set
2016-06-10 15:50:11 -04:00
Sean Chittenden
04c697c610
Update godoc for newServer to reflect DNS and IP-based inputs
...
Requested by: alex
2016-06-10 15:50:11 -04:00
Sean Chittenden
27413076fb
Pick the right DefaultConfig
from the right package.
...
Overly zealous search && replace at work here.
2016-06-10 15:50:11 -04:00
Sean Chittenden
7167b7a357
Add a quick set of client/rpcproxy.ServerEndpoint equality tests
2016-06-10 15:50:11 -04:00
Sean Chittenden
837b387dcb
Fix building tests that used DefaultConfig()
but didn't pickup the package move.
2016-06-10 15:50:11 -04:00
Sean Chittenden
b199743b8a
Add some trace-level logging for /v1/agent/servers when writing
...
This endpoint shouldn't be hit often, but this could be useful in
logs down the road.
2016-06-10 15:50:11 -04:00
Sean Chittenden
07fa89d2a5
Fix config_parse_test to reflect that consul.addr
does not exist.
...
`consul.address` does, but not `consul.addr`.
2016-06-10 15:50:11 -04:00
Sean Chittenden
7fe1944bc5
Fix tests for client.TestAgent_ServerConfig
...
Add similar logic in Agent `serverConfig()` to set up the
`serverSerfAddr` the same as `serverHttpAddr` and `serverRpcAddr`.
2016-06-10 15:50:11 -04:00
Sean Chittenden
3b5db4e390
Fix the client/rpcproxy unit tests.
2016-06-10 15:50:11 -04:00
Sean Chittenden
39fb0f2469
Change the endpoint for /v1/agent/servers
and fix tests.
...
When an agent is running a server, the list of servers includes the
Raft peers. When the agent is running a client (which is always the
case?), include a list of the servers found in the Client's RpcProxy.
Dedupe and provide a unique list back to the caller.
2016-06-10 15:50:11 -04:00
Sean Chittenden
6fdf9135cb
Provide a default ConsulConfig for client/config.DefaultConfig()
...
Change the unit test to only test if the consul link exists, not the
value of the link. The old test was hostname specific and therefore
would always be different based on the environment running the tests.
2016-06-10 15:50:11 -04:00
Sean Chittenden
cb80e93a6b
Move client.DefaultConfig() to client/config.DefaultConfig()
...
Resolves an import cycle in testing and is more appropriate because
the default should reside next to its struct definition.
2016-06-10 15:50:11 -04:00
Sean Chittenden
d87085e040
Fix a comment to be more correct
2016-06-10 15:50:11 -04:00
Sean Chittenden
c7e1879c4d
Unused code wasn't as unused as I thought. Restore.
2016-06-10 15:50:11 -04:00
Sean Chittenden
bff57a0dce
Reconcile, clean up, and centralize API version numbers (major and minor).
...
Reduce future confusion by introducing a minor version that is gossiped out
via the `mvn` Serf tag (Minor Version Number, `vsn` is already being used for
to communicate `Major Version Number`).
Background: hashicorp/consul/issues/1346#issuecomment-151663152
2016-06-10 15:50:11 -04:00
Sean Chittenden
b3fd455b1f
Register the serf service with the Nomad server service.
...
This will be unused in this PR.
2016-06-10 15:50:11 -04:00
Sean Chittenden
82d537fbd9
Update the nomad_server_service
default from nomad-server
to just nomad
.
2016-06-10 15:50:11 -04:00
Sean Chittenden
7c3838373b
Create a weak decoder to parse time.Duration.
...
Hat tip to Alex for pointing this out (vs patching mapstructure)
2016-06-10 15:50:11 -04:00
Sean Chittenden
6d9ec364e5
Change the constants used to match the struct definitions
2016-06-10 15:50:11 -04:00
Sean Chittenden
c013957d49
When clearing the backup servers, set the length to zero.
2016-06-10 15:50:11 -04:00
Sean Chittenden
36340c654d
Improve language re: fingerprinting
2016-06-10 15:50:11 -04:00
Sean Chittenden
bff82e4890
Remove unused function.
2016-06-10 15:50:11 -04:00
Sean Chittenden
498f21cdec
Clear the backup server list when a Nomad heartbeat arives with servers
...
If Nomad is heartbeating during a transition from using backup servers
to Nomad servers, make Nomad the canonical source of servers and flush
the list of servers populated from Consul.
2016-06-10 15:50:11 -04:00
Sean Chittenden
6cd01d7567
Nuke a.consulConfig in favor of a.consul.Config
2016-06-10 15:50:11 -04:00
Sean Chittenden
dde6a4074d
Nuke trace-level logging in heartbeats
2016-06-10 15:50:11 -04:00
Sean Chittenden
d76c042a13
Invert error handling logic
2016-06-10 15:50:11 -04:00
Sean Chittenden
1fe979a5e4
Remove types.ShutdownChannel and replace with chan struct{}
2016-06-10 15:50:11 -04:00
Sean Chittenden
2395aa481c
Fix unit tests
2016-06-10 15:50:11 -04:00
Sean Chittenden
438becb28b
Pass the datacenter name in the heartbeat
...
Servers that are part of a different datacenter are added as backup
servers instead of primary servers.
2016-06-10 15:50:11 -04:00
Sean Chittenden
930ac0268a
Silence unused variable warning
2016-06-10 15:50:11 -04:00
Sean Chittenden
89168b0c51
Invert check definition so the error is first
2016-06-10 15:50:11 -04:00
Sean Chittenden
d914f262f9
Consolidate all consul sync periodic go routines to handlers.
...
Only one pump and periodic loop now.
2016-06-10 15:50:11 -04:00
Sean Chittenden
9fb0104def
Teach Client to reuse an Agent's consulSyncer.
...
"There can be only one."
2016-06-10 15:50:11 -04:00
Sean Chittenden
47891fb559
Register two services each for clients and servers, http and rpc.
...
In order to give clients a fighting chance to talk to the right port,
differentiate RPC services from HTTP services by registering two
services with different tags. This yields
`rpc.nomad-server.service.consul` and
`http.nomad-server.service.consul` which is immensely more useful to
clients attempting to bootstrap their world.
2016-06-10 15:50:11 -04:00
Sean Chittenden
ac7881226c
Advertise the server's RPC endpoint, not its HTTP endpoint.
...
Rename c.serverRpcAddr to serverRpcAddr. This will be broken out
into in additional set of services in a subsequent commit.
2016-06-10 15:50:11 -04:00
Sean Chittenden
dc78baedfd
Fix typo in the comment to reflect the actual function name.
2016-06-10 15:50:11 -04:00
Sean Chittenden
d2f9848348
Bump the cluster test minimums to 10min.
...
These ranges aren't too useful with the default 600s rebalance, but
will be useful if that default ever changes in the future.
2016-06-10 15:50:11 -04:00
Sean Chittenden
861f900225
s/RpcVersion/RPCVersion/g
2016-06-10 15:50:11 -04:00
Sean Chittenden
bd0588ffa8
Bump shuffle interval per suggestion from Alex
2016-06-10 15:50:11 -04:00
Sean Chittenden
9f8d6c9f67
Move struct member to reduce diff context
2016-06-10 15:50:11 -04:00
Sean Chittenden
5570aa98e9
Fix package name in comments
2016-06-10 15:50:11 -04:00
Sean Chittenden
410d85cc78
Rename the package from client/rpc_proxy
to client/rpcproxy
...
Also rename `NewRpcProxy()` to just `New()` to avoid package stutter.
2016-06-10 15:50:11 -04:00
Sean Chittenden
be679c161c
Rename manager_test.go to rpc_proxy_test.go
2016-06-10 15:50:11 -04:00
Sean Chittenden
677f149b16
Rename RpcProxy's internal filename to match
2016-06-10 15:50:11 -04:00
Sean Chittenden
11d53fda00
Remove unused code
2016-06-10 15:50:11 -04:00
Sean Chittenden
10d1b6ba9b
Reduce all forms of ConsulConfig down to a single struct
...
nomad/structs/config/consul.go's ConsulConfig is the canonical definition
for all things Consul now.
2016-06-10 15:50:11 -04:00
Sean Chittenden
0dbd16aa5d
Rebalance Nomad client RPCs among different Nomad servers.
...
Implement client/rpc_proxy.RpcProxy.
2016-06-10 15:50:11 -04:00
Sean Chittenden
a13cbe73c3
Rename ConsulConfig to ConsulAgentConfig
2016-06-10 15:50:11 -04:00
Sean Chittenden
520fcb99de
Rename consulConfig to consulAgentConfig
2016-06-10 15:50:11 -04:00
Sean Chittenden
e6c78274c8
Rename client/config/config's ConsulConfig to ConsulAgentConfig
...
A follow up commit to the previous rename. More to come.
2016-06-10 15:50:11 -04:00