Alex Dadgar
a62e412b88
Refactor - wip
2018-06-12 10:23:45 -07: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
e858928d68
Rename Syncer.SetServiceIdentifier to SetServiceRegPrefix()
...
This attribute isn't actually an identifier because it can represent
a collection of services. Rename `serviceIdentifier` to
`serviceRegPrefix which more accurately conveys the intention of this
Syncer attribute.
While here, also rename `SetServiceIdentifier()` to `SetServiceRegPrefix()`
and `GenerateServiceIdentifier()` to `GenerateServicePrefix()`.
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
cf8beb7ba9
Change the signature of the PeriodicCallback to return an error
...
I *KNEW* I should have done this when I wrote it, but didn't want to
go back and audit the handlers to include the appropriate return
handling, but now that the code is taking shape, make this change.
2016-06-10 15:54:39 -04:00
Sean Chittenden
a2081159b4
Rename structs.Services to structs.ConsulServices
2016-06-10 15:54:39 -04:00
Sean Chittenden
107fc1bb81
Rename createCheck() to createDelegatedCheck() for clarity
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
86b5d318f8
Move const block to the top of the file.
...
Requested by: @dadgar
2016-06-10 15:50:11 -04:00
Sean Chittenden
07799b636a
Nuke the last of the explicit types in favor of using language idioms
2016-06-10 15:50:11 -04:00
Sean Chittenden
6264a8eff6
Unused code wasn't as unused as I thought. Restore.
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
bf4f0310b4
Remove unused function.
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
fc5658521c
index on f-dyn-server-list: bd38cb4 Remove unused code
2016-06-10 15:50:11 -04:00
Sean Chittenden
17927c8b9c
Only poll Consul for servers when Nomad heartbeats begin to fail
...
When a deadline timer of 2x Server's last requested TTL expires,
begin polling Consul for Nomad Servers.
2016-06-10 15:50:11 -04:00
Sean Chittenden
e07e77b79d
s/availble/runChecks/g
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
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
Sean Chittenden
7db2eb03c4
Use consul/lib's RandomStagger
...
Removes four redundant copies of the method in the process.
2016-06-10 15:48:36 -04:00
Diptanu Choudhury
522eebcbc1
Using a helper method to create service identifiers
2016-05-14 00:43:25 -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
50b03354f2
Fixed the consul tests
2016-05-11 15:22:58 -07:00
Diptanu Choudhury
2663ef9d6a
Refactored the signature of NewConsulService
2016-05-11 15:22:58 -07:00
Diptanu Choudhury
2a4431b09b
Added some docs
2016-05-05 11:52:22 -07:00
Diptanu Choudhury
03763d570b
Added logs to indicate when checks timeout
2016-05-05 10:01:38 -07:00
Diptanu Choudhury
1b8e663af7
Allowing registration of services which don't expose any ports
2016-04-14 13:26:39 +05:30
Diptanu Choudhury
7555c2e705
Setting check state to critical if check result had an error
2016-04-05 10:15:38 -07:00
Diptanu Choudhury
7ca2d28baa
Not logging if consul is unavailable
2016-04-02 14:48:10 -07:00
Diptanu Choudhury
5bec27a9a4
Using tls cert and key files while connecting to consul over https
2016-03-27 23:09:31 -07:00
Diptanu Choudhury
e0b9f038b0
Using a single timer to run checks
2016-03-25 16:11:45 -07:00
Diptanu Choudhury
bfc2a0d716
using switch to determine the state of checks
2016-03-25 14:26:56 -07:00
Diptanu Choudhury
f8db6a433f
Using tickers instead of creating new timers
2016-03-25 14:18:04 -07:00
Diptanu Choudhury
4c2766085a
Renamed NomadChecks to CheckRunner and a fix for checkrunner start
2016-03-25 10:36:31 -07:00
Diptanu Choudhury
7454ffd88b
Renamed NomadChecks to CheckRunner
2016-03-24 21:17:33 -07:00
Diptanu Choudhury
0fed52cb15
Removing non relevant tests
2016-03-24 19:31:24 -07:00
Diptanu Choudhury
52f7f93a09
Added some docs
2016-03-24 19:30:02 -07:00
Diptanu Choudhury
12dc439949
Changing the logic of keep services
2016-03-24 19:19:13 -07:00
Diptanu Choudhury
62249fe79f
Added an impl for Nomad Checks
2016-03-24 19:00:24 -07:00
Diptanu Choudhury
588666d0df
Introducing ConsulContext
2016-03-24 15:57:16 -07:00
Diptanu Choudhury
e8995be723
Fixed merge conflicts
2016-03-24 15:09:50 -07:00