Commit Graph

266 Commits

Author SHA1 Message Date
Michael Schurter
905bef8f2d consul: make grpc checks more like http checks 2018-05-04 11:08:11 -07:00
Michael Schurter
93356e7d70 consul: initial grpc implementation
Needs to be more like http.
2018-05-04 11:08:11 -07:00
Javier Palomo Almena
3e6c3437af DriverContext: Add the TaskGroup and the Job name
Adding this fields to the DriverContext object, will allow us to pass
them to the drivers.

An use case for this, will be to emit tagged metrics in the drivers,
which contain all relevant information:
- Job
- TaskGroup
- Task
- ...

Ref: https://github.com/hashicorp/nomad/pull/4185
2018-04-23 00:15:29 +02:00
Alex Dadgar
31b317b6ee drop stats fetching log 2018-03-23 12:01:50 -07:00
Preetha
c4389cd61a Merge pull request #3968 from hashicorp/f-nicer-vault-error
Make server side error messages from vault more clearer
2018-03-13 20:49:39 -05:00
Preetha Appan
d83ad728db Address some code review comments 2018-03-13 18:19:16 -05:00
Preetha Appan
71e4061e0e Remove error wrapping and make vault connection server side errors clearer. 2018-03-13 17:09:03 -05:00
Josh Soref
0afd7f8d56 spelling: transition 2018-03-11 19:06:05 +00:00
Josh Soref
61a2fe4124 spelling: periodically 2018-03-11 18:36:59 +00:00
Josh Soref
2007eab12e spelling: malicious 2018-03-11 18:26:25 +00:00
Michael Schurter
7dd5dbdd56 Drop log level to TRACE
For people not using driver networks these log lines would just be
confusing.
2018-01-18 15:35:24 -08:00
Michael Schurter
6d77215f37 Improve driver network logging 2018-01-18 15:35:24 -08:00
Michael Schurter
29e6f7cbfd Fix interpolation bug with service/check updates
Previously if only an interpolated variable used in a service or check
was changed we interpolated the old and new services and checks with the
new variable, so nothing appeared to have changed.
2017-12-08 12:03:00 -08:00
Alex Dadgar
d427ab70c1 Only publish metric when the task is running and dev mode publishes metrics 2017-11-15 13:21:06 -08:00
Michael Schurter
0de0e1d342 Handle leader task being dead in RestoreState
Fixes the panic mentioned in
https://github.com/hashicorp/nomad/issues/3420#issuecomment-341666932

While a leader task dying serially stops all follower tasks, the
synchronizing of state is asynchrnous. Nomad can shutdown before all
follower tasks have updated their state to dead thus saving the state
necessary to hit this panic: *have a non-terminal alloc with a dead
leader.*

The actual fix is a simple nil check to not assume non-terminal allocs
leader's have a TaskRunner.
2017-11-15 10:36:13 -08:00
Preetha Appan
b3631f3d32 Remove event GenericSource, and address other code review comments. Also added deprecation info in comments. 2017-11-03 10:10:06 -05:00
Preetha Appan
d63e693679 Move logic for determinic event display message to task_runner, added two new fields DisplayMessage and Details. 2017-11-03 09:13:01 -05:00
Alex Dadgar
a9e3a41407 Enable more linters 2017-09-26 15:26:33 -07:00
Michael Schurter
fa836d8ca5 Name const after what it represents 2017-09-15 14:57:18 -07:00
Michael Schurter
a508bb9709 Fold SetFailure into SetRestartTriggered 2017-09-14 16:48:39 -07:00
Michael Schurter
f8e872c855 RestartDelay isn't needed as checks are re-added on restarts
@dadgar made the excellent observation in #3105 that TaskRunner removes
and re-registers checks on restarts. This means checkWatcher doesn't
need to do *any* internal restart tracking. Individual checks can just
remove themselves and be re-added when the task restarts.
2017-09-14 16:48:39 -07:00
Michael Schurter
568b963270 Remove unused lastStart field 2017-09-14 16:47:41 -07:00
Michael Schurter
526528c7c9 Removed partially implemented allocLock 2017-09-14 16:47:41 -07:00
Michael Schurter
3db835cb8f Improve check watcher logging and add tests
Also expose a mock Consul Agent to allow testing ServiceClient and
checkWatcher from TaskRunner without actually talking to a real Consul.
2017-09-14 16:47:41 -07:00
Michael Schurter
c2d895d47a Add comments and move delay calc to TaskRunner 2017-09-14 16:46:54 -07:00
Michael Schurter
ebbf87f979 Use existing restart policy infrastructure 2017-09-14 16:46:54 -07:00
Michael Schurter
1608e59415 Add check watcher for restarting unhealthy tasks 2017-09-14 16:46:54 -07:00
Chelsea Holland Komlo
681a3f337a fixups from code review 2017-09-05 14:13:34 +00:00
Chelsea Holland Komlo
50ab667799 create base labels to be used in every metric 2017-09-05 14:13:34 +00:00
Chelsea Holland Komlo
7a96f92290 emit metrics using labels, add option for backwards compatibility 2017-09-05 14:12:57 +00:00
Michael Schurter
7627c1705b Update and test service/check interpolation 2017-08-17 16:49:14 -07:00
Michael Schurter
f143501c31 Merge pull request #3043 from hashicorp/f-2441-shutdown-delay
Add optional shutdown delay to tasks
2017-08-17 14:37:48 -07:00
Michael Schurter
ecf0d20af7 Make shutdown delay log DEBUG, not INFO 2017-08-17 11:28:33 -07:00
Michael Schurter
beae45bad5 Add optional shutdown delay to tasks
Fixes #2441

Defaults to 0 (no delay) for backward compat and because this feature
should be opt-in.
2017-08-16 17:59:46 -07:00
Alex Dadgar
c26ecb7092 Add version package
This PR adds a version package and consolidates version strings into a
Version struct.
2017-08-16 15:44:21 -07:00
Alex Dadgar
a066856d72 Merge pull request #3001 from hashicorp/f-template-events
Template emits events explaining why it is blocked
2017-08-10 13:00:58 -07:00
Alex Dadgar
1e7ae913e2 Template emits events explaining why it is blocked
This PR does the following:
* Adds a mechanism to emit events in the TaskRunner
* Vendors a new version of Consul-Template that allows extraction of
missing dependencies
* Adds logic to our consul_template.go to determine missing events and
emit them in a batched fashion.
* Refactors the consul_template code to split the run method and take in
a config struct rather than many parameters.

Fixes https://github.com/hashicorp/nomad/issues/2578
2017-08-09 18:01:27 -07:00
Alex Dadgar
43d2c425d1 Emit generic task events 2017-08-07 21:26:04 -07:00
Luke Farnell
7a56971508 fixed all spelling mistakes for goreport 2017-08-07 17:13:05 -04:00
Michael Schurter
a96fc052dd Fix tr race by not sharing alloc/task
prestart only needs the original alloc/task so pass their pointers in.
Task updates may concurrently replace the pointer on tr.
2017-07-21 16:17:42 -07:00
Michael Schurter
96127527a1 Fix handle race 2017-07-21 14:00:32 -07:00
Michael Schurter
55713e2a61 Always interpolate task before calling with Consul
Also switch to returning a copy of the task to avoid races between
altering the Task and persitence.
2017-07-21 13:37:16 -07:00
Michael Schurter
738321efa3 Don't save task runner state if it is destroyed 2017-07-20 10:17:41 -07:00
Michael Schurter
4117c8b3a2 Fix Service.AddressMode changes during task updates 2017-06-21 17:19:08 -07:00
Michael Schurter
8a7df57227 Test driver network advertisement and checks 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
72a24aecb0 Add env.Builder.UpdateTask for alloc updates 2017-05-23 16:00:57 -07:00
Michael Schurter
1295f88d03 Handle Driver.Prestart returning nil, nil 2017-05-23 13:53:34 -07:00
Michael Schurter
a96fb5dbb0 Move task env into execcontext
Also inject PATH into rkt commands since we're no longer appending host
env vars for it.
2017-05-23 13:53:34 -07:00
Michael Schurter
6db35013d2 Add PortMap to struct returned by Driver.Prestart
Moves env.Builder out of drivers entirely so one less thing to worry
about when implementing driver plugins.
2017-05-23 13:53:34 -07:00