Commit Graph

249 Commits

Author SHA1 Message Date
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
Michael Schurter
37c1cbc9cf Move env template handling into consul_template.go 2017-05-23 13:53:34 -07:00
Michael Schurter
96753dcbcb Improve PortMap handling and simplify Builder creation 2017-05-23 13:53:34 -07:00
Michael Schurter
3b24980680 Move path building to task dir initialization 2017-05-23 13:53:34 -07:00
Michael Schurter
ace00980a1 Refactor TaskEnvironment into Builder and TaskEnv 2017-05-23 13:53:33 -07:00
Michael Schurter
7dac668adf Functional consul template env file support 2017-05-23 13:45:14 -07:00
Michael Schurter
70fdc46abc Merge pull request #2591 from hashicorp/b-2180-script-updates
Properly interpolate services on updated tasks
2017-05-17 09:09:01 -07:00
Alex Dadgar
e47be9f771 Merge branch 'master' into f-bolt-db 2017-05-09 11:11:55 -07:00
Alex Dadgar
3f1ccf7278 Respond to comments 2017-05-09 10:50:24 -07:00
Michael Schurter
499ada5a64 Merge pull request #2585 from hashicorp/b-2554-container-exec
Execute exec/java script checks in containers
2017-05-05 10:31:18 -07:00
Michael Schurter
a39eef0f11 Test pre06ScriptCheck 2017-05-04 16:49:00 -07:00
Michael Schurter
9012357414 Oops, remove dev logging 2017-05-04 16:27:04 -07:00
Michael Schurter
3999b57e7d Build new env from new alloc before interpolating 2017-05-04 15:06:15 -07:00
Alex Dadgar
e22393aeb8 Restore state + upgrade path 2017-05-02 18:21:49 -07:00
Alex Dadgar
85a81f47de Revert "metrics"
This reverts commit 4d6a012c6f.
2017-05-02 09:28:11 -07:00
Alex Dadgar
7dee8ae534 perf 2017-05-01 16:01:50 -07:00
Alex Dadgar
4d6a012c6f metrics 2017-05-01 14:51:27 -07:00
Alex Dadgar
5aa6e18807 Use batching 2017-05-01 14:50:34 -07:00