Sean Chittenden
a1a0c313de
Skip nil check for agent's consulSyncer is always not nil
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
c54539b860
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
06e5e615a8
Rename command/agent/consul/sync.go to syncer.go
2016-06-10 15:54:39 -04:00
Sean Chittenden
d307ca2c28
Begin leveraging the Agent-level consul.Syncer
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
Sean Chittenden
6b126ce488
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
e24de53ead
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
555f4fe135
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
e2a561204a
Fix typo in comment
2016-06-10 15:50:11 -04:00
Sean Chittenden
f671dac6cc
Fix test TestClientConfigCommand_UpdateServers()
...
Now that hostnames are validated on input, switch to IPs since they
bypass DNS resolution.
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
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
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
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
6cd01d7567
Nuke a.consulConfig in favor of a.consul.Config
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
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
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
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
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
Sean Chittenden
e727fd8c3c
Centralize the creation of a consul/api.Config struct.
...
While documented, the consul.timeout parameter wasn't ever set
except one-off in the Consul fingerprinter.
2016-06-10 15:50:11 -04:00
Sean Chittenden
f695d6d70d
Reconcile consul's address configuration section.
...
There were conflicting directives previously, both consul.addr and
consul.address were required to achieve the desired behavior. The
documentation said `consul.address` was the canonical name for the
parameter, so consolidate configuration parameters to `consul.address`.
2016-06-10 15:50:11 -04:00
Sean Chittenden
bd779c3719
Reconcile renamed structures during rebase
2016-06-10 15:50:11 -04:00
Sean Chittenden
882364f4d9
An Agent's consulSyncer is always not nil now.
2016-06-10 15:50:11 -04:00
Sean Chittenden
98cea9ba07
Revise Agent.syncAgentServicesWithConsul()'s interface
...
Reduce down to its lowest common helper function denominator.
2016-06-10 15:50:11 -04:00
Sean Chittenden
b5c70f3729
Alpha sort config keys for Consul
2016-06-10 15:50:11 -04:00
Sean Chittenden
d1442dc317
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
e60580b279
Define a type for the PeriodicCallback handlers and ShutdownChannel
2016-06-10 15:50:11 -04:00
Sean Chittenden
17116fc5a7
Rebalance Nomad client RPCs among different Nomad servers.
...
Implement client/rpc_proxy.RpcProxy.
2016-06-10 15:50:11 -04:00
Sean Chittenden
88f3422d7c
Rename NewConsulService to NewSyncer
2016-06-10 15:49:37 -04:00
Sean Chittenden
b9789e0cf7
Rename client/consul/sync.PeriodicSync to Run
2016-06-10 15:49:37 -04:00
Sean Chittenden
768aab015d
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
b509da2d0c
Create a nomad/structs/config
to break an import cycle.
...
Flattening and normalizing the various Consul config structures and
services has led to an import cycle. Break this by creating a new package
that is intended to be terminal in the import DAG.
2016-06-10 15:48:36 -04:00
Sean Chittenden
840b49a720
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
c7a680c28f
Rename consulConfig to consulAgentConfig
2016-06-10 15:48:36 -04:00
Sean Chittenden
73e173673e
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
e97652bbfb
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
e36686a17d
Use consul/lib's RandomStagger
...
Removes four redundant copies of the method in the process.
2016-06-10 15:48:36 -04:00
Alex Dadgar
b4fa34a854
Merge pull request #1252 from hashicorp/f-blocked-eval-text
...
Better placement failure text for blocked evals
2016-06-10 11:41:41 -07:00
Alex Dadgar
f006aeeb20
helper
2016-06-10 11:02:15 -07:00
Alex Dadgar
93a8af1422
better placement failure text for blocked evals
2016-06-10 10:56:32 -07:00
Alex Dadgar
3cf74e7fd8
Alloc-status only shows measured statistics and fixes to CPU calculations
2016-06-10 10:38:29 -07:00
Diptanu Choudhury
872957e015
Merge pull request #1246 from hashicorp/fix-node-cpu-usage
...
Changed the logic of calculation of node cpu usage
2016-06-09 19:29:12 -07:00
Diptanu Choudhury
ef2d630ea4
Changed the logic of calculation of node cpu usage
2016-06-10 03:24:42 +01:00
Alex Dadgar
5d181d203c
Add check-index flag to nomad run
2016-06-08 17:56:32 -07:00
Alex Dadgar
2102855ae7
Merge pull request #1237 from hashicorp/b-regions
...
CLI can forward request to different regions
2016-06-08 11:00:23 -07:00
Diptanu Choudhury
66052700ca
Moving the stats error to the bottom of alloc status
2016-06-08 12:28:41 -04:00
Diptanu Choudhury
843d7e224e
Moving the stats error to the bottom of node status
2016-06-08 12:21:20 -04:00
Diptanu Choudhury
5074121e70
Fixed the formating of % in nomad alloc status
2016-06-08 08:53:33 -04:00
Alex Dadgar
77dd3af134
docs
2016-06-07 11:33:55 -07:00
Alex Dadgar
a0557e766e
Run and plan automatically sets the region
2016-06-07 11:28:07 -07:00
Alex Dadgar
86e368cdb8
Add region flag and environment variable
2016-06-07 11:16:04 -07:00
Alex Dadgar
08b16573a9
Merge pull request #1227 from hashicorp/upstream-scada-provider
...
Use upstream high-level SCADA provider
2016-06-07 09:47:24 -07:00
Diptanu Choudhury
4a35ffa1ef
Indicating which values are percentages
2016-06-06 16:10:34 -07:00
Diptanu Choudhury
c21d606ebb
Getting inodes used percent back
2016-06-06 16:10:34 -07:00
Diptanu Choudhury
9db3b002b0
Showing detailed resource usage stats in alloc-stats
2016-06-06 16:10:34 -07:00
Diptanu Choudhury
5ca21b2906
Showing task resource usage in alloc status
2016-06-06 16:10:34 -07:00
Diptanu Choudhury
1bf3280f95
Showing actual resource usage
2016-06-06 16:10:34 -07:00
Diptanu Choudhury
10b9eeef56
Added the stats flag
2016-06-06 16:10:34 -07:00
Diptanu Choudhury
d928d02d85
Removing inode percent since it doesn't work in some cases
2016-06-06 16:10:34 -07:00
Jeff Mitchell
b4f25e0b04
Use upstream high-level SCADA provider
2016-06-01 18:25:09 -04:00
Alex Dadgar
0f84d8968b
Merge pull request #1221 from hashicorp/b-nil-wait
...
fix wait result being nil and some panics in the cli
2016-05-31 16:50:38 -07:00
Alex Dadgar
4e15611339
fix wait result being nil and some panics in the cli
2016-05-31 23:09:05 +00:00
Alex Dadgar
b1298bb658
plan shows failure reasons and ordered annotations
2016-05-31 21:51:23 +00:00
Alex Dadgar
4dd7b621f0
Merge pull request #1206 from hashicorp/f-eval-status
...
Introduce eval-status and deprecate eval-monitor
2016-05-31 11:19:44 -07:00
Alex Dadgar
8b7d3e90a9
Clean failed placement output
2016-05-31 18:18:58 +00:00
Diptanu Choudhury
fd1b0dfd49
Fixed a test
2016-05-31 01:58:32 +02:00
Diptanu Choudhury
f95b1d00c3
Renamed error message in alloc endpoint
2016-05-28 20:03:52 -07:00
Diptanu Choudhury
f0c381e7d7
Added a test for alloc stats api endpoint
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
eb5d831099
Added a test for the clients stats endpoint
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
c0dc6cfbf2
Changing the api of the stats endpoints
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
9499759013
Fixed the docs for the stats command
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
a0c279f3b2
comments
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
37e8e0dc35
Fixed the node status cli command
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
a64062d6a6
Fixed the compilation on linux
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
0b0d0764e4
Changed signature of Allocation Stats Reporter
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
c46400597e
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
464812ea3b
Changed the stats endpoints
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
ecf2492138
Making task a flag in the stats command
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
05c221186b
Added disk usage to node status
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
cf247c1309
Added uptime to node stats
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
73fa700a88
Showing host resource usage stats
2016-05-28 19:59:20 -07:00
Diptanu Choudhury
313c61b9db
Added pidstats in task resource usage struct
2016-05-28 19:59:20 -07:00