Commit Graph

169 Commits

Author SHA1 Message Date
Sean Chittenden 917766a3df
Prefer `%+q` over `%q` in log messages. 2016-06-11 18:17:20 -04:00
Sean Chittenden bbd8dfa798
goling(1) compliance pass (e.g. Rpc* -> RPC) 2016-06-10 23:38:28 -04:00
Sean Chittenden bc771d35df
Query for the Nomad service across multiple Consul datacenters. 2016-06-10 23:05:14 -04:00
Sean Chittenden d99467ef5e
Always create a consul.Syncer. Use a default Consul Config if necessary. 2016-06-10 15:55:27 -04:00
Sean Chittenden f6a0459ae5
Always create a consul.Syncer. Use a default Consul Config if necessary. 2016-06-10 15:55:27 -04:00
Sean Chittenden 447fe59fd2
Hand wave over the syncer tests atm, these will be fixed shortly. 2016-06-10 15:54:39 -04:00
Sean Chittenden fa7285cb5b
Don't spam the consul if Consul is not available.
Log once when Consul goes away, and log when Consul comes back.
2016-06-10 15:54:39 -04:00
Sean Chittenden a2109af862
Properly cover Syncer attributes with the registryLock.
trackedServices, delegateChecks, trackedChecks, and checkRunners
should all be covered.  This lock needs to be reasonably narrow and
can't use defer due to possible recursive locking concerns further
downstream from the call sites.
2016-06-10 15:54:39 -04:00
Sean Chittenden f9b561b52f
On Syncer Shutdown, remove all services that match a Syncer's prefix. 2016-06-10 15:54:39 -04:00
Sean Chittenden 57e084e4df
Sync checks with Consul by comparing the AgentCheckReg w/ ConsulService
The source of truth is the local Nomad Agent.  Any checks are not local that
have a matching prefix are removed.  Changed checks are re-registered
and missing checks are re-added.
2016-06-10 15:54:39 -04:00
Sean Chittenden 197feae679
Sync services with Consul by comparing the AgentServiceReg w/ ConsulService
The source of truth is the local Nomad Agent.  Any services not local that
have a matching prefix are removed.  Changed services are re-registered
and missing services are re-added.
2016-06-10 15:54:39 -04:00
Sean Chittenden 9a223936bb
Generate and sync Consul ServiceIDs consistently 2016-06-10 15:54:39 -04:00
Sean Chittenden bcad11cc2a
Rename runChecks to consulAvailable
Apologies in advance for the variable thrash, the fingerprinter is
no longer used to gate whether or not Consul is available any more.
2016-06-10 15:54:39 -04:00
Sean Chittenden efe00d2ccd
Update Syncer.Run() to call SyncServices(). 2016-06-10 15:54:39 -04:00
Sean Chittenden 83775c5c8b
Add "Service Groups" to the Syncer.
Now the right way to register services with the Syncer is to call
`SetServices(groupName, []*services)`.  This was required to allow
the Syncer to sync either the Client, Server, or Both using a
single Syncer.
2016-06-10 15:54:39 -04:00
Sean Chittenden 06e5e615a8
Rename command/agent/consul/sync.go to syncer.go 2016-06-10 15:54:39 -04:00
Sean Chittenden 7956eb0c80
Rename structs.Task's `Service` attribute to `ConsulService` 2016-06-10 15:54:39 -04:00
Sean Chittenden 05a2b9528c
Remove Syncer.registerService()
This call is obsolete by a future commit that changes the canonical
source of truth to be consul.AgentServiceRegistration structs, which
means it is not necessary to construct AgentServiceRegistration
objects every time a registration is made, we just reuse the existing
object.
2016-06-10 15:54:39 -04:00
Sean Chittenden 8c813630e6
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