Commit Graph

3823 Commits

Author SHA1 Message Date
Mahmood Ali
b6ae5e9d62 Render consul templates using task env only (#6055)
When rendering a task consul template, ensure that only task environment
variables are used.

Currently, `consul-template` always falls back to host process
environment variables when key isn't a task env var[1].  Thus, we add
an empty entry for each host process env-var not found in task env-vars.

[1] bfa5d0e133/template/funcs.go (L61-L75)
2019-08-05 16:30:47 -04:00
Mahmood Ali
2e0d67cbbb Merge pull request #6065 from hashicorp/b-nil-driver-exec
Check if driver handle is nil before execing
2019-08-02 09:48:28 -05:00
Mahmood Ali
488cd7e24e Check if driver handle is nil before execing
Defend against tr.getDriverHandle being nil.  Exec handler checks if
task is running, but it may be stopped between check and driver handler
fetching.
2019-08-02 10:07:41 +08:00
Nick Ethier
0b8fc5d018 client/cni: updated comments and simplified logic to auto download plugins 2019-07-31 01:04:10 -04:00
Nick Ethier
1072084ff3 Apply suggestions from code review
Co-Authored-By: Mahmood Ali <mahmood@hashicorp.com>
2019-07-31 01:04:10 -04:00
Nick Ethier
54ce4d1f7e client: remove debugging lines 2019-07-31 01:04:09 -04:00
Nick Ethier
0bd157cc3b client: add autofetch for CNI plugins 2019-07-31 01:04:09 -04:00
Nick Ethier
4dd5cd103d remove unused file 2019-07-31 01:04:09 -04:00
Nick Ethier
e910fdbb32 fix failing tests 2019-07-31 01:04:07 -04:00
Nick Ethier
dc08ec8783 ar: plumb client config for networking into the network hook 2019-07-31 01:04:06 -04:00
Nick Ethier
e15005bdcb networking: Add new bridge networking mode implementation 2019-07-31 01:04:06 -04:00
Michael Schurter
eb2a2cd76e connect: add group.service stanza support 2019-07-31 01:04:05 -04:00
Nick Ethier
9fa47daf5c ar: fix lint errors 2019-07-31 01:03:19 -04:00
Nick Ethier
56d5fe704a ar: rearrange network hook to support building on windows 2019-07-31 01:03:19 -04:00
Nick Ethier
508ff3cf2f ar: fix test that failed due to error renaming 2019-07-31 01:03:19 -04:00
Nick Ethier
da3978b377 plugins/driver: make DriverNetworkManager interface optional 2019-07-31 01:03:19 -04:00
Nick Ethier
35de444e9b ar: plumb error handling into alloc runner hook initialization 2019-07-31 01:03:18 -04:00
Nick Ethier
16343ae23a ar: add tests for network hook 2019-07-31 01:03:18 -04:00
Nick Ethier
c742f8b580 ar: cleanup lint errors 2019-07-31 01:03:18 -04:00
Nick Ethier
c39e8dca6e ar: move linux specific code to it's own file and add tests 2019-07-31 01:03:18 -04:00
Nick Ethier
4a8a96fa1a ar: initial driver based network management 2019-07-31 01:03:17 -04:00
Nick Ethier
e20fa7ccc1 Add network lifecycle management
Adds a new Prerun and Postrun hooks to manage set up of network namespaces
on linux. Work still needs to be done to make the code platform agnostic and
support Docker style network initalization.
2019-07-31 01:03:17 -04:00
Preetha Appan
ebd7002683 remove generated code and change version to 0.10.0 2019-07-30 15:56:05 -05:00
Nomad Release bot
a81aa846a4 Generate files for 0.9.4 release 2019-07-30 19:05:18 +00:00
Preetha Appan
31d674bf39 remove generated code 2019-07-23 12:07:49 -05:00
Nomad Release bot
4999923574 Generate files for 0.9.4-rc1 release 2019-07-22 21:42:36 +00:00
Michael Schurter
1a90b2d082 logmon: fix comment formattinglogmon: fix comment formattinglogmon: fix
comment formattinglogmon: fix comment formattinglogmon: fix comment
formatting
2019-07-22 13:05:01 -07:00
Michael Schurter
12c6ceb27b logmon: ensure errors are still handled properly
...and add a comment to switch back to the old error handling once we
switch to Go 1.12.
2019-07-22 12:49:48 -07:00
Danielle Lancashire
e0126123ab logmon: Workaround golang/go#29119
There's a bug in go1.11 that causes some io operations on windows to
return incorrect errors for some cases when Stat-ing files. To avoid
upgrading to go1.12 in a point release, here we loosen up the cases
where we will attempt to create fifos, and add some logging of
underlying stat errors to help with debugging.
2019-07-22 18:28:12 +02:00
Jasmine Dahilig
e31db578e0 add formatting for hcl parsing error messages (#5972) 2019-07-19 10:04:39 -07:00
Mahmood Ali
80b1344653 Update consul-template dependency to latest
To pick up the fix in
https://github.com/hashicorp/consul-template/pull/1231 .
2019-07-18 07:32:03 +07:00
Mahmood Ali
66bef39dd5 log unrecoverable errors 2019-07-17 11:01:59 +07:00
Mahmood Ali
bbf8f90ecb client/taskrunner: fix stats stats retry logic
Previously, if a channel is closed, we retry the Stats call.  But, if that call
fails, we go in a backoff loop without calling Stats ever again.

Here, we use a utility function for calling driverHandle.Stats call that retries
as one expects.

I aimed to preserve the logging formats but made small improvements as I saw fit.
2019-07-11 13:58:07 +08:00
Preetha Appan
16648b3e70 Test file for detect content type that satisfies linter and encoding 2019-07-10 11:42:04 -05:00
Preetha Appan
7de4018656 code review feedback 2019-07-10 10:41:06 -05:00
Preetha Appan
26652d7a6b Populate task event struct with kill timeout
This makes for a nicer task event message
2019-07-09 09:37:09 -05:00
Preetha Appan
0eae387a96 fix linting failure in test case file 2019-07-08 11:29:12 -05:00
Michael Lange
37f7ecafa2 Use consistent casing in the JSON representation of the AllocFileInfo struct 2019-07-02 17:27:31 -07:00
Preetha Appan
6c52f843e0 Added additional test cases and fixed go test case 2019-07-02 13:25:29 -05:00
Mahmood Ali
72f67c57cb Merge pull request #5905 from hashicorp/b-ar-failed-prestart
Fail alloc if alloc runner prestart hooks fail
2019-07-02 20:25:53 +08:00
Danielle
7968f799a5 Merge pull request #5864 from hashicorp/dani/win-pipe-cleaner
windows: Fix restarts using the raw_exec driver
2019-07-02 13:58:56 +02:00
Danielle Lancashire
c712fdcbd9 fifo: Safer access to Conn 2019-07-02 13:12:54 +02:00
Mahmood Ali
99802390c1 run post-run/post-stop task runner hooks
Handle when prestart failed while restoring a task, to prevent
accidentally leaking consul/logmon processes.
2019-07-02 18:38:32 +08:00
Mahmood Ali
380262613d Fail alloc if alloc runner prestart hooks fail
When an alloc runner prestart hook fails, the task runners aren't invoked
and they remain in a pending state.

This leads to terrible results, some of which are:
* Lockup in GC process as reported in https://github.com/hashicorp/nomad/pull/5861
* Lockup in shutdown process as TR.Shutdown() waits for WaitCh to be closed
* Alloc not being restarted/rescheduled to another node (as it's still in
  pending state)
* Unexpected restart of alloc on a client restart, potentially days/weeks after
  alloc expected start time!

Here, we treat all tasks to have failed if alloc runner prestart hook fails.
This fixes the lockups, and permits the alloc to be rescheduled on another node.

While it's desirable to retry alloc runner in such failures, I opted to treat it
out of scope.  I'm afraid of some subtles about alloc and task runners and their
idempotency that's better handled in a follow up PR.

This might be one of the root causes for
https://github.com/hashicorp/nomad/issues/5840 .
2019-07-02 18:35:47 +08:00
Mahmood Ali
bd7d60ef93 Merge pull request #5890 from hashicorp/b-dont-start-completed-allocs-2
task runner to avoid running task if terminal
2019-07-02 15:31:17 +08:00
Mahmood Ali
009f186eb7 address review comments 2019-07-02 14:53:50 +08:00
Mahmood Ali
22960f821e Merge pull request #5906 from hashicorp/b-alloc-stale-updates
client: defensive against getting stale alloc updates
2019-07-02 12:40:17 +08:00
Preetha Appan
de8ae8bcd2 Improve test cases for detecting content type 2019-07-01 16:24:48 -05:00
Danielle Lancashire
8148466da6 fifo: Close connections and cleanup lock handling 2019-07-01 14:14:29 +02:00
Danielle Lancashire
2e5aba9188 logmon: Add windows compatibility test 2019-07-01 14:14:06 +02:00