Commit Graph

175 Commits

Author SHA1 Message Date
Alex Dadgar
fbfeecb486 Fix TestAllocRunner_SaveRestoreState 2017-03-02 20:45:46 -08:00
Alex Dadgar
833b4bd4dc Merge branch 'master' into b-remount 2017-03-02 19:23:13 -08:00
Michael Schurter
ad4559d019 Safely ensure {dev,proc,alloc} are mounted
If they're unmounted by a reboot they'll be properly remounted.
2017-03-02 13:21:34 -08:00
Alex Dadgar
2a683cddea Update go-getter and add support for git and hg
Fixes https://github.com/hashicorp/nomad/issues/2042
2017-03-01 14:46:04 -08:00
Alex Dadgar
4826d8464e Fix two issues during client restore state
This PR fixes two issues:

1) A close of a nil stopCollection channel when restoring and prestart
fails. The failure will cause the killCh to be triggered which will
close collection before it has been initialized.

2) Fixes a deadlock in which the handleWaitCh is never triggered since
it is not initialized when there is an error in prestart and the killCh
is triggered.

Both fixes are by maintaining the loop invariant that the two channels
are valid after there is a handle.
2017-02-28 10:29:12 -08:00
Alex Dadgar
7447ccd7e4 Fix tests and docs 2017-02-22 18:28:07 -08:00
Diptanu Choudhury
c80bdd9f5f Adding a task event for setup 2017-02-22 18:28:07 -08:00
Michael Schurter
a760fbcea6 Use getters & setters with nil guards 2017-02-09 17:44:58 -08:00
Michael Schurter
c961e751ec Fix upgrade path for created resources
This *might* be a fix for #2295 -- I've been unable to reproduce the
bug. However, this guard seems wise regardless. I should never be
overwriting an intialized created resources with a nil.
2017-02-09 13:54:33 -08:00
Michael Schurter
2822dd760c Handle createdResourcs=nil
Combined with b522c472fd this fixes #2256

Without these two commits in place upgrades to 0.5.3 panics.
2017-01-31 10:51:32 -08:00
Alex Dadgar
314435261d Rename dispatch_input to dispatch_payload 2017-01-25 21:27:44 -08:00
Michael Schurter
78c9c00ba8 Fix index we get allocs by 2017-01-20 16:30:40 -08:00
Michael Schurter
783118b34d Update created resources before exiting cleanup 2017-01-19 16:48:23 -08:00
Michael Schurter
828151ea38 Exit early when cleanup succeeds 2017-01-19 15:07:01 -08:00
Michael Schurter
cf0157af89 Fix incorrect lock usage 2017-01-19 11:39:18 -08:00
Michael Schurter
db096b23b5 Switch to use recoverable errors from Cleanup
TaskRunner handles retrying but Cleanup handles all of CreatedResources.
2017-01-13 16:46:08 -08:00
Michael Schurter
1ec5c930a6 Return errors from cleanup and let TaskRunner retry 2017-01-12 17:21:54 -08:00
Michael Schurter
33c015bcc7 Add Cleanup method to Driver interface
Cleanup can be used for cleaning up resources created by drivers to run
a task. Initially the Docker driver is the only user (to remove
downloaded images).
2017-01-11 17:23:33 -08:00
Alex Dadgar
6687d38e00 Merge pull request #2173 from hashicorp/b-stats
Don't retrieve Driver Stats if unsupported
2017-01-10 13:32:03 -08:00
Alex Dadgar
fa7db8cdd4 Don't retrieve Driver Stats if unsupported
This PR makes us only try to collect stats once if the Driver doesn't
support collecting stats.

Fixes https://github.com/hashicorp/nomad/issues/1986
2017-01-09 13:47:06 -08:00
Alex Dadgar
e3ed6219d9 Merge pull request #2164 from hashicorp/b-dispatch
Create Task directory structure in the Run method
2017-01-09 11:24:46 -08:00
Alex Dadgar
276e5ccbd2 Move to Run() 2017-01-08 13:55:12 -08:00
Alex Dadgar
b69ea1f65c Create task directory during Prestart() 2017-01-08 13:55:12 -08:00
Alex Dadgar
0641d8a3d1 Send Driver events to servers immediately
This PR causes driver events to be sent to the server immediately rather
than waiting for Prestart() to finish.
2017-01-08 13:54:43 -08:00
Michael Schurter
de7351b959 Move chroot building into TaskRunner
* Refactor AllocDir to have a TaskDir struct per task.
* Drivers expose filesystem isolation preference
* Fix lxc mounting of `secrets/`
2017-01-05 16:31:49 -08:00
Alex Dadgar
248c069652 Merge pull request #2128 from hashicorp/f-dispatch
Nomad Constructor Jobs and Dispatch
2017-01-06 05:22:49 +08:00
Michael Schurter
aaa70ab7b8 Append host env vars on every task env 2016-12-20 12:24:24 -08:00
Michael Schurter
750d59773c Rename InitializationMessage to DriverMessage 2016-12-20 11:51:09 -08:00
Alex Dadgar
d1ecd38c25 Client writes payload to disk 2016-12-16 15:11:56 -08:00
Michael Schurter
ee17940dfe Add Driver.Prestart method
The Driver.Prestart method currently does very little but lays the
foundation for where lifecycle plugins can interleave execution _after_
task environment setup but _before_ the task starts.

Currently Prestart does two things:

* Any driver specific task environment building
* Download Docker images

This change also attaches a TaskEvent emitter to Drivers, so they can
emit events during task initialization.
2016-12-02 11:03:48 -08:00
Alex Dadgar
e64875f4cd Merge pull request #1941 from hashicorp/b-complete-transistion
Task state "dead" is terminal
2016-11-04 17:16:10 -07:00
Alex Dadgar
392e7b609c More precise marking of dead 2016-11-04 17:11:07 -07:00
Alex Dadgar
ad8b5bc141 Task state "dead" is terminal 2016-11-04 16:57:24 -07:00
Alex Dadgar
0ce8a21fe2 Fix tests 2016-11-04 15:10:18 -07:00
Alex Dadgar
16d1fede7d Unique task 2016-11-04 14:53:37 -07:00
Alex Dadgar
55e7d6f7c6 Create container much more robust 2016-11-04 14:39:56 -07:00
Alex Dadgar
f2fd8f0413 Download artifacts before templates 2016-10-31 11:29:26 -07:00
Alex Dadgar
d70fd7e426 Fix passing of recoverable error from docker pull 2016-10-28 17:49:46 -07:00
Alex Dadgar
e398a0d804 Consul-template fixes + PreviousAlloc in api 2016-10-28 15:50:35 -07:00
Alex Dadgar
9c932aaf2a Interpolate and then validate services 2016-10-25 14:27:49 -07:00
Alex Dadgar
96594c49a7 Fix merge 2016-10-24 17:04:10 -07:00
Alex Dadgar
7c3a2d08a3 Merge pull request #1848 from hashicorp/f-vault-error
Thread through whether DeriveToken error is recoverable or not
2016-10-24 15:01:18 -07:00
Alex Dadgar
4d99c19428 Small fixes 2016-10-22 18:20:50 -07:00
Alex Dadgar
42f7bc8e81 Thread through whether DeriveToken error is recoverable or not 2016-10-22 18:08:30 -07:00
Alex Dadgar
f130c8a894 Change how we mark tasks as failed and allow consul-template to fail tasks 2016-10-20 17:27:16 -07:00
Alex Dadgar
70d0e6e1a3 Feedback 2016-10-18 15:01:04 -07:00
Alex Dadgar
4048d1db5c Comments 2016-10-18 11:36:04 -07:00
Alex Dadgar
ae288a3ee6 Tests 2016-10-18 11:24:20 -07:00
Alex Dadgar
e34902ae8a Large refactor of task runner and Vault token rehandling 2016-10-18 11:24:20 -07:00
Alex Dadgar
917c7e5085 Merge pull request #1801 from hashicorp/f-signals
Consul-template signal change mode
2016-10-18 11:23:47 -07:00