Commit Graph

75 Commits

Author SHA1 Message Date
Michael Schurter
1608e59415 Add check watcher for restarting unhealthy tasks 2017-09-14 16:46:54 -07:00
Alex Dadgar
3b300925a2 Fix alloc health with checks using interpolation
Fixes an issue in which the allocation health watcher was checking for
allocations health based on un-interpolated services and checks. Change
the interface for retrieving check information from Consul to retrieving
all registered services and checks by allocation. In the future this
will allow us to output nicer messages.

Fixes https://github.com/hashicorp/nomad/issues/2969
2017-08-07 16:27:08 -07:00
Alex Dadgar
f72bbaa370 Client watches for allocation health using task state and Consul checks
This PR adds watching of allocation health at the client. The client can
watch for health based on the tasks running on time and also based on
the consul checks passing.
2017-07-07 12:10:04 -07:00
Michael Schurter
4117c8b3a2 Fix Service.AddressMode changes during task updates 2017-06-21 17:19:08 -07:00
Michael Schurter
3fddb05fc8 Implement DriverNetwork and Service.AddressMode
Ideally DriverNetwork would be fully populated in Driver.Prestart, but
Docker doesn't assign the container's IP until you start the container.

However, it's important to setup the port env vars before calling
Driver.Start, so Prestart should populate that.
2017-06-21 17:19:08 -07:00
Michael Schurter
63a8307255 Move ScriptExecutor to driver 2017-04-19 12:42:47 -07:00
Michael Schurter
b6937912d8 Add UpdateTask method instead of Remove/Add 2017-04-19 12:42:47 -07:00
Michael Schurter
10cb924b2c Refactor Consul Syncer into new ServiceClient
Fixes #2478 #2474 #1995 #2294

The new client only handles agent and task service advertisement. Server
discovery is mostly unchanged.

The Nomad client agent now handles all Consul operations instead of the
executor handling task related operations. When upgrading from an
earlier version of Nomad existing executors will be told to deregister
from Consul so that the Nomad agent can re-register the task's services
and checks.

Drivers - other than qemu - now support an Exec method for executing
abritrary commands in a task's environment. This is used to implement
script checks.

Interfaces are used extensively to avoid interacting with Consul in
tests that don't assert any Consul related behavior.
2017-04-19 12:42:47 -07:00
Diptanu Choudhury
701a1bd9bc Hooking up the executor in all drivers 2016-03-23 13:19:45 -07:00
Alex Dadgar
98d3a92a12 Remove a concurrent map access 2016-03-02 13:57:08 -08:00
Alex Dadgar
b290b8ef79 Update the consul service when the task/alloc changes 2016-02-06 17:08:20 -08:00
Ryan Slade
f681f57eb0 Fix a typo 2016-01-27 17:49:32 +02:00
Diptanu Choudhury
5340767c29 Printing error message if check is not valid 2016-01-07 17:51:57 -08:00
Diptanu Choudhury
cbc70a5465 Changed some comments 2015-12-14 18:05:58 -08:00
Diptanu Choudhury
f089e249c8 Renamed serviceId to serviceID 2015-12-14 15:57:56 -08:00
Diptanu Choudhury
d4d7572604 Making the allocs hold service ids 2015-12-14 15:08:35 -08:00
Diptanu Choudhury
4b41cfc43e Fixed log printing logic 2015-12-11 15:45:49 -08:00
Diptanu Choudhury
519dc4c65b Exctracted nomad- to a constant 2015-12-11 14:06:51 -08:00
Diptanu Choudhury
568006247d Making a struct to hold consul service config 2015-12-11 14:06:51 -08:00
Diptanu Choudhury
f182c13729 Deregister services and checks which are managed by Nomad 2015-12-11 14:06:51 -08:00
Diptanu Choudhury
42b4a34046 Not continuing sync if we couldn't get services and checks from consul 2015-12-11 13:10:20 -08:00
Diptanu Choudhury
e1d2d5877a Printing most of the consul messages only when the agent is available 2015-12-11 09:22:47 -08:00
Diptanu Choudhury
6af01d2d6f Muted the consul debug messages 2015-12-11 09:06:03 -08:00
Diptanu Choudhury
56fa8f8a03 Changing naming and debug message schemes 2015-12-10 16:47:43 -08:00
Diptanu Choudhury
ccfde99f82 Generate check names, check id and service id on the server side 2015-12-10 16:07:17 -08:00
Charlie Drage
d5fc7f6022 Fix minor spelling error 2015-12-10 18:09:14 -05:00
Diptanu Choudhury
65c9a361aa Added some extra log lines 2015-12-10 06:05:07 -08:00
Diptanu Choudhury
27a0097ab6 Fixing some log lines 2015-12-07 06:25:00 -08:00
Halil Kaskavalci
728a6e3fd7 Fixed git vet error on formatting 2015-11-30 10:27:26 +00:00
Diptanu Choudhury
0f39fa5703 Fixed some docs 2015-11-26 13:47:02 -08:00
Diptanu Choudhury
c1e9db0f93 Added more docs 2015-11-26 11:25:09 -08:00
Diptanu Choudhury
0534c4a640 Added a mock consul api client 2015-11-26 01:03:16 -08:00
Diptanu Choudhury
6067b30d51 Fixed a few tests 2015-11-26 00:26:10 -08:00
Diptanu Choudhury
cdb28bf46f Added a test for modifying check 2015-11-25 18:37:51 -08:00
Diptanu Choudhury
75d95a4c83 Fixed merge conflicts 2015-11-25 18:32:37 -08:00
Diptanu Choudhury
67fd39fce0 Added some comments 2015-11-25 18:31:11 -08:00
Diptanu Choudhury
f2f5f7ee36 Fixed tests 2015-11-25 18:23:47 -08:00
Diptanu Choudhury
e6ff842e8f making the service checks in service pointers 2015-11-25 17:44:57 -08:00
Diptanu Choudhury
a106b03416 Made the logic to track checks simpler 2015-11-25 17:28:44 -08:00
Diptanu Choudhury
84a61a9fcd Using the service id in check hash 2015-11-25 15:17:27 -08:00
Diptanu Choudhury
ee14aa2781 Added options for adding more consul configuration 2015-11-25 13:39:16 -08:00
Diptanu Choudhury
e9019d1256 Improved tests 2015-11-25 12:06:14 -08:00
Diptanu Choudhury
92c635d278 Added a test to make sure we are adding a check to a service 2015-11-25 11:20:36 -08:00
Diptanu Choudhury
566897b60f Saving the host and port in tracked service 2015-11-24 18:58:53 -08:00
Diptanu Choudhury
e2370999de Fixing comment and syntax 2015-11-24 18:43:23 -08:00
Diptanu Choudhury
02f2c55f9f Implemented syncing of checks 2015-11-24 18:39:38 -08:00
Diptanu Choudhury
78555b509a Tracking the tasks too 2015-11-24 17:26:30 -08:00
Diptanu Choudhury
3051958323 Added a test to re-sync services 2015-11-24 14:37:14 -08:00
Diptanu Choudhury
b0c8cf6e36 Renamed consul client to service 2015-11-24 12:34:26 -08:00
Diptanu Choudhury
448ac3efd6 Registering Checks independently 2015-11-24 10:02:33 -08:00