Commit graph

15358 commits

Author SHA1 Message Date
Danielle Lancashire 13d76e35fd
trhooks: Add TaskStopHook interface to services
We currently only run cleanup Service Hooks when a task is either
Killed, or Exited. However, due to the implementation of a task runner,
tasks are only Exited if they every correctly started running, which is
not true when you recieve an error early in the task start flow, such as
not being able to pull secrets from Vault.

This updates the service hook to also call consul deregistration
routines during a task Stop lifecycle event, to ensure that any
registered checks and services are cleared in such cases.

fixes #5770
2019-06-12 16:00:21 +02:00
Danielle Lancashire ae8bb7365a
alloc-lifecycle: Fix restart with empty body
Currently when you submit a manual request to the alloc lifecycle API
with a version of Curl that will submit empty bodies, the alloc restart
api will fail with an EOF error.

This behaviour is undesired, as it is reasonable to not submit a body at
all when restarting an entire allocation rather than an individual task.

This fixes it by ignoring EOF (not unexpected EOF) errors and treating
them as entire task restarts.
2019-06-12 15:35:00 +02:00
Danielle Lancashire bea23e1eb1
docs: Add missing docs for alloc restart api 2019-06-12 15:09:52 +02:00
Mahmood Ali 07f2c77c44 comment DenormalizeAllocationDiffSlice applies to terminal allocs only 2019-06-12 08:28:43 -04:00
Mahmood Ali b00d1f1e10 tests: parsing dir should be equivalent to parsing individual files 2019-06-12 08:19:09 -04:00
Mahmood Ali 3d8f2622e9 tests: avoid manipulating package variables 2019-06-12 08:16:32 -04:00
Mahmood Ali 2fb8cdd484
Merge pull request #5818 from hashicorp/b-consul-stanza
fix consul stanza parsing when multiple -config arguments are used
2019-06-12 06:29:24 -04:00
Lang Martin 3837c9b021 command add comments re: defaults to LoadConfig 2019-06-11 22:35:43 -04:00
Lang Martin 02aae678be config_parse_test update comment for accuracy 2019-06-11 22:30:20 -04:00
Lang Martin 7aa95ebd6f config_parse get rid of ParseConfigDefault 2019-06-11 22:00:23 -04:00
Lang Martin 9b0411af6a Revert "config explicitly merge defaults once when using a config directory"
This reverts commit 006a9a1d454739eee21b7d8abb8b7aef1353b648.
2019-06-11 22:00:23 -04:00
Mahmood Ali 1fcb1567bc correct GH-5812 changelog 2019-06-11 19:46:50 -04:00
Mahmood Ali 4993252601 changelog GH-5817 2019-06-11 19:44:18 -04:00
Mahmood Ali fbf226bd25
Merge pull request #5817 from hashicorp/b-consul-stanza
fix consul stanza parsing when a configuration directory is used
2019-06-11 19:17:32 -04:00
Lang Martin 1e2f87a11e agent/testdata add a configuration directory for testing 2019-06-11 16:34:04 -04:00
Lang Martin fe8a4781d8 config merge maintains *HCL string fields used for duration conversion 2019-06-11 16:34:04 -04:00
Lang Martin 3bd153690b config_parse_test, handle defaults 2019-06-11 16:34:04 -04:00
Lang Martin c97dd512f4 config explicitly merge defaults once when using a config directory 2019-06-11 15:42:27 -04:00
Lang Martin ad56434472 config_parse split out defaults from ParseConfig 2019-06-11 15:42:27 -04:00
Buck Doyle 93e7f60be5
Change Netlify site id (#5814)
The Netlify site now belongs to the Hashicorp organisation
rather than the hc-nomad user.
2019-06-11 14:25:55 -05:00
Preetha Appan cd813e50ec
Add warning docs around downgrades 2019-06-11 13:16:37 -05:00
Mahmood Ali 6f2bcb8775 scripts: use /dev/null when verifying s3 2019-06-11 13:30:54 -04:00
Mahmood Ali 165a4ea868 update changelog for 0.9.3 2019-06-11 13:25:27 -04:00
Mahmood Ali 79698489dc
Merge pull request #5806 from hashicorp/b-systemd-cgroups-path
drivers/exec: use an independent name=systemd cgroup path
2019-06-11 13:00:44 -04:00
Mahmood Ali 5734c8a648 update comment 2019-06-11 13:00:26 -04:00
Mahmood Ali d16f9df59b
Merge pull request #5812 from hashicorp/fix-allocresources-reference
Fallback to `alloc.TaskResources` for old allocs
2019-06-11 11:33:25 -04:00
Mahmood Ali 2acf30fdd3 Fallback to alloc.TaskResources for old allocs
When a client is running against an old server (e.g. running 0.8),
`alloc.AllocatedResources` may be nil, and we need to check the
deprecated `alloc.TaskResources` instead.

Fixes https://github.com/hashicorp/nomad/issues/5810
2019-06-11 10:32:53 -04:00
Lang Martin a476cff2ba
Merge pull request #5802 from hashicorp/b-config-meta-parsing
config meta parsing
2019-06-11 09:12:36 -04:00
Mahmood Ali 3dd9b939e3
Merge pull request #5805 from hashicorp/b-tg-rename-panic
Fix a panic related to updating alloc taskgroups
2019-06-11 08:53:55 -04:00
Mahmood Ali f7608c4cef exec: use an independent name=systemd cgroup path
We aim for containers to be part of a new cgroups hierarchy independent
from nomad agent.  However, we've been setting a relative path as
libcontainer `cfg.Cgroups.Path`, which makes libcontainer concatinate
the executor process cgroup with passed cgroup, as set in [1].

By setting an absolute path, we ensure that all cgroups subsystem
(including `name=systemd` get a dedicated one).  This matches behavior
in Nomad 0.8, and behavior of how Docker and OCI sets CgroupsPath[2]

Fixes #5736

[1] d7edf9b2e4/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/apply_raw.go (L326-L340)
[2] 238f8eaa31/vendor/github.com/containerd/containerd/oci/spec.go (L229)
2019-06-10 22:00:12 -04:00
Mahmood Ali 7a4900aaa4 client/allocrunner: depend on internal task state
Alloc runner already tracks tasks associated with alloc.  Here, we
become defensive by relying on the alloc runner tracked tasks, rather
than depend on server never updating the job unexpectedly.
2019-06-10 18:42:51 -04:00
Mahmood Ali 392f5bac44 Stop updating allocs.Job on stopping or preemption 2019-06-10 18:30:20 -04:00
Mahmood Ali 6c8e329819 test that stopped alloc jobs aren't modified
When an alloc is stopped, test that we don't update the job found in
alloc with new job  that is no longer relevent for this alloc.
2019-06-10 17:14:26 -04:00
Yishan Lin cf4d7c90a6 Revised Nomad Enterprise page
- Revised Enterprise content to reflect new pricing & packaging modules
- Consolidated feature pages into single Enterprise pager
- Made each feature into its own subsection on the Enterprise page
- Added direct links to their respective guides below
- Upleveled all Enterprise features onto the navbar
- Updated redirects
2019-06-10 14:08:15 -07:00
Lang Martin a337488b5c config parse update hcl with support for decoding bool to string 2019-06-10 13:12:38 -04:00
Lang Martin 28cf8eddfe config parse_test check for string coercion in client.meta 2019-06-10 13:12:38 -04:00
James Rasell fcd8444779
Fix incorrect link to the sample Grafana dashboard
closes #5799
2019-06-10 17:26:27 +02:00
Mahmood Ali 6742ef5d73 changelog GH-5794 2019-06-10 09:56:23 -04:00
Buck Doyle 16a5681e8a
Add PR previews with Netlify (#5787)
It would be preferable to only generate these for UI PRs but Netlify appears to
not have that flexibility. I tried setting up manual deployments in a Travis
environment but gave up the experiment; it could probably eventually work if
deployment failures become a nuisance.
2019-06-10 08:51:58 -05:00
Mahmood Ali 8f2308d070
Merge pull request #5794 from hashicorp/b-preemption-network-panic
Only preempt for network when there is a network
2019-06-10 07:10:29 -04:00
Mahmood Ali 5dc404ecab Only preempt for network when there is a network
When examining preemption for networks, only consider allocs that have
networks.

Fixes https://github.com/hashicorp/nomad/issues/5793
2019-06-07 18:55:55 -04:00
Mahmood Ali 98575f5788 test: add tests for network devices and preemption 2019-06-07 18:55:02 -04:00
Michael Schurter 6c116add0f docs: move dev docs to contributing 2019-06-07 15:41:13 -07:00
Michael Schurter 96fa01ac3c docs: mention ui & website as "core components" 2019-06-07 08:33:35 -07:00
Michael Schurter 9365253f65 docs: require Go 1.11+ 2019-06-07 08:33:24 -07:00
Mahmood Ali d70e328b77
Merge pull request #5776 from hashicorp/b-flaky-e2e-test
flaky e2e test
2019-06-06 20:26:17 -04:00
Mahmood Ali fd8fb8c22b Stop allocs to be rescheduled
Currently, when an alloc fails and is rescheduled, the alloc desired
state remains as "run" and the nomad client may not free the resources.

Here, we ensure that an alloc is marked as stopped when it's
rescheduled.

Notice the Desired Status and Description before and after this change:

Before:
```
mars-2:nomad notnoop$ nomad alloc status 02aba49e
ID                   = 02aba49e
Eval ID              = bb9ed1d2
Name                 = example-reschedule.nodes[0]
Node ID              = 5853d547
Node Name            = mars-2.local
Job ID               = example-reschedule
Job Version          = 0
Client Status        = failed
Client Description   = Failed tasks
Desired Status       = run
Desired Description  = <none>
Created              = 10s ago
Modified             = 5s ago
Replacement Alloc ID = d6bf872b

Task "payload" is "dead"
Task Resources
CPU        Memory          Disk     Addresses
0/100 MHz  24 MiB/300 MiB  300 MiB

Task Events:
Started At     = 2019-06-06T21:12:45Z
Finished At    = 2019-06-06T21:12:50Z
Total Restarts = 0
Last Restart   = N/A

Recent Events:
Time                       Type            Description
2019-06-06T17:12:50-04:00  Not Restarting  Policy allows no restarts
2019-06-06T17:12:50-04:00  Terminated      Exit Code: 1
2019-06-06T17:12:45-04:00  Started         Task started by client
2019-06-06T17:12:45-04:00  Task Setup      Building Task Directory
2019-06-06T17:12:45-04:00  Received        Task received by client

```

After:

```
ID                   = 5001ccd1
Eval ID              = 53507a02
Name                 = example-reschedule.nodes[0]
Node ID              = a3b04364
Node Name            = mars-2.local
Job ID               = example-reschedule
Job Version          = 0
Client Status        = failed
Client Description   = Failed tasks
Desired Status       = stop
Desired Description  = alloc was rescheduled because it failed
Created              = 13s ago
Modified             = 3s ago
Replacement Alloc ID = 7ba7ac20

Task "payload" is "dead"
Task Resources
CPU         Memory          Disk     Addresses
21/100 MHz  24 MiB/300 MiB  300 MiB

Task Events:
Started At     = 2019-06-06T21:22:50Z
Finished At    = 2019-06-06T21:22:55Z
Total Restarts = 0
Last Restart   = N/A

Recent Events:
Time                       Type            Description
2019-06-06T17:22:55-04:00  Not Restarting  Policy allows no restarts
2019-06-06T17:22:55-04:00  Terminated      Exit Code: 1
2019-06-06T17:22:50-04:00  Started         Task started by client
2019-06-06T17:22:50-04:00  Task Setup      Building Task Directory
2019-06-06T17:22:50-04:00  Received        Task received by client
```
2019-06-06 17:27:12 -04:00
Michael Schurter 32f844e470 docs: remove subbullet points
They render ambiguously
2019-06-06 14:05:32 -07:00
Michael Schurter 93adf2e286 docs: CLI -> client
The UI is a client too!
2019-06-06 14:05:13 -07:00
Mahmood Ali e6cec7984a
Merge pull request #5788 from hashicorp/b-fix-node-down-test
tests: Migrated allocs aren't lost
2019-06-06 16:58:35 -04:00