Commit Graph

88 Commits

Author SHA1 Message Date
Sean Chittenden
5331ea7bc6 goling(1) compliance pass (e.g. Rpc* -> RPC) 2016-06-10 23:38:28 -04:00
Sean Chittenden
a423f07d63 Stash client and server registration behind consul.auto_register 2016-06-10 15:54:39 -04:00
Sean Chittenden
05e713cfca Skip nil check for agent's consulSyncer is always not nil 2016-06-10 15:54:39 -04:00
Sean Chittenden
a4f605a789 Initialize Consul for the Nomad Agent in a more uniform way.
Decompose Client and Server registration into `setupClient()` and
`setupServer()`, respectively.
2016-06-10 15:54:39 -04:00
Sean Chittenden
7ad5cd571c Begin leveraging the Agent-level consul.Syncer 2016-06-10 15:54:39 -04:00
Sean Chittenden
57c2c819e8 Move package client/consul/sync to command/agent/consul.
This has been done to allow the Server and Client to reuse the same
Syncer because the Agent may be running Client, Server, or both
simultaneously and we only want one Syncer object alive in the agent.
2016-06-10 15:54:39 -04:00
Sean Chittenden
74e691cab1 Change the API signature of Syncer.SyncServices().
SyncServices() immediately attempts to sync whatever information
the process has with Consul.  Previously this method would take an
argument of the exclusive list of services that should exist,
however this is not condusive to having a Nomad Client and Nomad
Server share the same consul.Syncer.
2016-06-10 15:54:39 -04:00
Sean Chittenden
acb3d58b82 Refine Nomad's Consul port handling.
Previously this would immediately default to '127.0.0.1' if the
config was set to `:some-port-number`.  Now it uses the BindAddr
if available.  Also, if the `port` option is set to just a port`
number (e.g. '1234'), attempt to parse the port number by itself
to allow statically configured ports to work, even when no host is
specified.
2016-06-10 15:54:39 -04:00
Sean Chittenden
1352f7f0e6 Change client/consul.NewSyncer() to accept a shutdown channel
In addition to the API changing, consul.Syncer can now be signaled
to shutdown via the Shutdown() method, which will call the Run()'ing
sync task to exit gracefully.
2016-06-10 15:54:39 -04:00
Sean Chittenden
ab434b4079 Fix typo in comment 2016-06-10 15:50:11 -04:00
Sean Chittenden
a55395678f 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
b9f230b7b2 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
b2357598ba 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
ca0f2d982d Nuke a.consulConfig in favor of a.consul.Config 2016-06-10 15:50:11 -04:00
Sean Chittenden
3d22c22bf5 Remove types.ShutdownChannel and replace with chan struct{} 2016-06-10 15:50:11 -04:00
Sean Chittenden
4d47eedd58 Teach Client to reuse an Agent's consulSyncer.
"There can be only one."
2016-06-10 15:50:11 -04:00
Sean Chittenden
bc86e897ed 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
ce8c03d708 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
1fa43a09dd 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
4d30c98aa6 Rename consulConfig to consulAgentConfig 2016-06-10 15:50:11 -04:00
Sean Chittenden
5e0d76f7ce 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
Sean Chittenden
c159e77fe3 An Agent's consulSyncer is always not nil now. 2016-06-10 15:50:11 -04:00
Sean Chittenden
89d48c8e82 Revise Agent.syncAgentServicesWithConsul()'s interface
Reduce down to its lowest common helper function denominator.
2016-06-10 15:50:11 -04:00
Sean Chittenden
d268dcb85d 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
f6e3587321 Define a type for the PeriodicCallback handlers and ShutdownChannel 2016-06-10 15:50:11 -04:00
Sean Chittenden
ffcd2332d4 Rebalance Nomad client RPCs among different Nomad servers.
Implement client/rpc_proxy.RpcProxy.
2016-06-10 15:50:11 -04:00
Sean Chittenden
7c6ad53d89 Rename NewConsulService to NewSyncer 2016-06-10 15:49:37 -04:00
Sean Chittenden
f280c59633 Rename client/consul/sync.PeriodicSync to Run 2016-06-10 15:49:37 -04:00
Sean Chittenden
d84d71847c Rename client/consul/sync.ConsulService to client/consul/sync.Syncer
Syncer describes the responsibility and actions of the type.
2016-06-10 15:49:37 -04:00
Sean Chittenden
af72200cf4 Distill config.Config.ConsulConfig down to config.Config.Consul
The enclosed struct provides the necessary context
2016-06-10 15:48:36 -04:00
Sean Chittenden
1f7bfb30d9 Rename consulConfig to consulAgentConfig 2016-06-10 15:48:36 -04:00
Sean Chittenden
4fed6b0ab5 Rename client/config/config's ConsulConfig to ConsulAgentConfig
A follow up commit to the previous rename.  More to come.
2016-06-10 15:48:36 -04:00
Sean Chittenden
0e1bdad2a0 Rename consul.ConsulConfig to consul.AgentConfig
There were two `ConsulConfig` structs running around, one of them
needed to go away.  Rely on the package's path to provide context
for the type of AgentConfig.
2016-06-10 15:48:36 -04:00
Diptanu Choudhury
bf6c034fec Making the stats collection interval and number of data points to keep in memory configurable 2016-05-28 19:59:20 -07:00
Diptanu Choudhury
9d8f6d0837 Added a test for generation of the server addr 2016-05-24 21:29:13 -07:00
Diptanu Choudhury
f1c96df3f3 Using the bind addr as server's IP if advertise addr and addresses.HTTP is not specified 2016-05-24 17:27:09 -07:00
Diptanu Choudhury
25273db2c1 Using the auto-register flag 2016-05-16 18:23:01 +02:00
Diptanu Choudhury
f2de4f2019 Using advertise addr for the http address 2016-05-14 01:09:05 -07:00
Diptanu Choudhury
8c5aa0fe65 Added some docs 2016-05-14 00:36:26 -07:00
Diptanu Choudhury
b2c18168a4 Making Nomad register services with consul in dev mode 2016-05-13 10:19:49 -07:00
Diptanu Choudhury
de660c4acf Removed allocID and task name from consul service 2016-05-11 16:26:41 -07:00
Diptanu Choudhury
a2237a6057 Implemented registering client and server services 2016-05-11 16:07:02 -07:00
Diptanu Choudhury
1e9fa644a4 removing interfaces from config 2016-04-07 13:25:38 -07:00
Alex Dadgar
b818379576 add nomad fingerprinter 2016-03-22 17:12:30 -07:00
Diptanu Choudhury
f8db94671e Overriding the device configuration if addresses is present 2016-03-20 23:41:16 -07:00
Diptanu Choudhury
97f56d6cc1 Using the interfaces for configuring bind addrs for nomad servers 2016-03-19 00:54:19 -07:00
Diptanu Choudhury
ce29ce5b53 Setting the ip from the network interface to Addresses 2016-03-18 22:26:13 -07:00
Diptanu Choudhury
ab4b1e1f09 Using the interface name to find bind address for network services 2016-03-18 21:44:22 -07:00
Diptanu Choudhury
c51db58509 Added an interfaces config 2016-03-18 13:50:29 -07:00
Alex Dadgar
4293811651 reserve resources on the node 2016-03-13 19:05:41 -07:00