Commit graph

16199 commits

Author SHA1 Message Date
Danielle Lancashire b67215d4f8
logging: Sort files when pruning old logs
Currently this logging implementation is dependent on the order of files
as returned by filepath.Glob, which although internal methods are
documented to be lexographical, does not publicly document this. Here we
defensively resort.
2019-10-10 13:51:16 +02:00
Emamul Andalib fcd70b91ac Update consul.html.md (#6456)
"you may have have" to "you may have".
2019-10-09 12:35:16 -04:00
Omar Khawaja 9f8cc217e6
update Nomad and Consul versions along with Ubuntu vagrant box version (#6451) 2019-10-09 12:30:23 -04:00
Nicolas Decoster 85ece246f5
fix typo in HCL code
Code contains `resource` instead of `resources` (plural).
2019-10-09 15:13:46 +02:00
Luiz Aoqui 3be8364636
Merge pull request #6444 from hashicorp/docs-add-prefix-param-to-acl-endpoints
docs: improve documentation for `prefix` param on API endpoints
2019-10-08 19:08:27 -04:00
Luiz Aoqui 521c0ad2a5
docs: clarify prefix API param requirements 2019-10-08 18:11:56 -04:00
Preetha e0b4ebe0b4
Merge pull request #6439 from hashicorp/f-docs-clarify-job-gc-interval
clarify version for new gc config in server stanza
2019-10-08 16:43:03 -05:00
Chris Baker cb11b77724
Merge pull request #6428 from Norbinsh/master
Docs: remove small duplication
2019-10-08 16:40:04 -05:00
Seth Hoenig fd75d8a487
Merge pull request #6447 from hashicorp/contributing-doc-tweaks
contributing: fix typo & append RPC checklist
2019-10-08 14:54:56 -05:00
Seth Hoenig e2b34550d6 contributing: fix typo & append RPC checklist 2019-10-08 19:28:35 +00:00
Michael Schurter 5f1ab36638
Merge pull request #6443 from hashicorp/docs-jobspec-checklist
docs: add sidebar to jobspec checklist
2019-10-08 12:27:28 -07:00
Buck Doyle 9a3a6c3f62
UI: Update to Ember 3.8 LTS (#5968) 2019-10-08 13:44:19 -05:00
Michael Schurter c0cfb1f9f0
Merge pull request #6446 from hashicorp/revert-6445-revert-6395-b-missing-vault-sercret
Revert "Revert "Use joint context to cancel prestart hooks""
2019-10-08 11:35:34 -07:00
Michael Schurter f54f1cb321
Revert "Revert "Use joint context to cancel prestart hooks"" 2019-10-08 11:34:09 -07:00
Michael Schurter fb835b19be
Merge pull request #6445 from hashicorp/revert-6395-b-missing-vault-sercret
Revert "Use joint context to cancel prestart hooks"
2019-10-08 11:28:18 -07:00
Michael Schurter 81a30ae106
Revert "Use joint context to cancel prestart hooks" 2019-10-08 11:27:08 -07:00
Luiz Aoqui b9ef978641
docs: add missing prefix param to the ACL API endpoints 2019-10-08 14:13:36 -04:00
Michael Schurter 3d3a445ee7 docs: add sidebar to jobspec checklist 2019-10-08 10:55:53 -07:00
Mahmood Ali e8942312bb
Merge pull request #6442 from hashicorp/b-alloc-namespace-check
acl: check ACL against object namespace
2019-10-08 13:26:38 -04:00
Mahmood Ali 4b2ba62e35 acl: check ACL against object namespace
Fix a bug where a millicious user can access or manipulate an alloc in a
namespace they don't have access to.  The allocation endpoints perform
ACL checks against the request namespace, not the allocation namespace,
and performs the allocation lookup independently from namespaces.

Here, we check that the requested can access the alloc namespace
regardless of the declared request namespace.

Ideally, we'd enforce that the declared request namespace matches
the actual allocation namespace.  Unfortunately, we haven't documented
alloc endpoints as namespaced functions; we suspect starting to enforce
this will be very disruptive and inappropriate for a nomad point
release.  As such, we maintain current behavior that doesn't require
passing the proper namespace in request.  A future major release may
start enforcing checking declared namespace.
2019-10-08 12:59:22 -04:00
Mahmood Ali b89712432b
Merge pull request #6440 from hashicorp/docs-release-096
Update website and changelog with 0.9.6
2019-10-08 12:56:27 -04:00
Mahmood Ali 3c0d8c7611
Merge pull request #6441 from hashicorp/b-agent-token
Redact replication tokens in /agent/self
2019-10-08 12:55:45 -04:00
Mahmood Ali 0f105215d9 update CHANGELOG with 0.9.6 changes 2019-10-08 12:50:53 -04:00
Mahmood Ali 1563c64bae website: Publish release 0.9.6 2019-10-08 12:48:05 -04:00
Preetha Appan 350e7f6952 clarify version for new gc config in server stanza 2019-10-08 10:08:27 -05:00
Charlie Voiselle 1276b84301
Merge pull request #6435 from hashicorp/doc-host-volume-update
Docs: Updated Host Volumes guide
2019-10-08 09:13:09 -04:00
Charlie Voiselle 9e8d9c2c8c Updated Host Volumes guide
Added read_only to highlight them
Style updates
2019-10-07 14:17:30 -04:00
Omar Khawaja 01f2ca6941
Upgrade Nomad terraform directory for TF 0.12+ (#6424)
* update

* fix error

* convert server ips in list of string and loop through for output

* drop the for loop in outputs and keep the join command

* switched to TF 0.12 splat expression
2019-10-07 12:43:42 -04:00
Charlie Voiselle b777bc98c7 Added grpc info; small style fixes 2019-10-07 10:59:52 -04:00
Danielle Lancashire 9eaac48f25
agent: Refactor log setup to support log-to-file 2019-10-07 14:42:32 +02:00
Danielle Lancashire 442f4888b3
agent: Introduce File Logger
This commit introduces a rotating file logger for Nomad Agent Logs. The
logger implementation itself is a lift and shift from Consul, with tests
updated to fit with the Nomad pattern of using require, and not having a
testutil for creating tempdirs cleanly.
2019-10-07 14:37:31 +02:00
Danielle Lancashire d3614ea0a8
config: Add required configuration for logging to a file 2019-10-07 14:16:59 +02:00
Norbinsh 7e97823ed8 Docs: remove small duplication 2019-10-05 13:00:32 +03:00
Mahmood Ali d09355efe4 cli: show full id for single node or alloc status
Show full ID on individual alloc or node status views.  Shortening
the ID isn't very helpful in these cases, and makes looking up the full
id slightly more complicated when user needs to interact with API.

List views are unmodified and show short id unless `-vebose` flag is passed.

Before
```
$ nomad node status -self | head -n2
ID            = 21fc51f9
Name          = mars-2.local

$ nomad alloc status 15ae54cd | head -n3
ID                  = 15ae54cd-08dd-3681-03cf-4c23ace7e7c3
Eval ID             = a6b15f86
Name                = example.cache[0]
```

After:
```
$ nomad node status -self | head -n2
ID            = 21fc51f9-fd39-0fa0-fb41-f34c7aa36101
Name          = mars-2.local

$ nomad alloc status 15ae54cd | head -n3
ID                  = 15ae54cd-08dd-3681-03cf-4c23ace7e7c3
Eval ID             = a6b15f86-ca8e-e536-b544-4bfb43137ff3
Name                = example.cache[0]
```
2019-10-04 16:36:18 -04:00
Mahmood Ali 317e0f9e44 agent: report fs log errors as http errors
This fixes two bugs:

First, FS Logs API endpoint only propagated error back to user if it was
encoded with code, which isn't common.  Other errors get suppressed and
callers get an empty response with 200 error code.  Now, these endpoints
return  a 500 status code along with the error message.

Before
```
$ curl -v "http://127.0.0.1:4646/v1/client/fs/logs/qwerqwera?follow=false&offset=0&origin=start&region=global&task=redis&type=stdout"; echo
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 4646 (#0)
> GET /v1/client/fs/logs/qwerqwera?follow=false&offset=0&origin=start&region=global&task=redis&type=stdout HTTP/1.1
> Host: 127.0.0.1:4646
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Vary: Accept-Encoding
< Vary: Origin
< Date: Fri, 04 Oct 2019 19:47:21 GMT
< Content-Length: 0
<
* Connection #0 to host 127.0.0.1 left intact
```

After
```
$ curl -v "http://127.0.0.1:4646/v1/client/fs/logs/qwerqwera?follow=false&offset=0&origin=start&region=global&task=redis&type=stdout"; echo
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 4646 (#0)
> GET /v1/client/fs/logs/qwerqwera?follow=false&offset=0&origin=start&region=global&task=redis&type=stdout HTTP/1.1
> Host: 127.0.0.1:4646
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error
< Vary: Accept-Encoding
< Vary: Origin
< Date: Fri, 04 Oct 2019 19:48:12 GMT
< Content-Length: 60
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host 127.0.0.1 left intact
alloc lookup failed: index error: UUID must be 36 characters
```

Second, we return 400 status code for request validation errors.

Before
```
$ curl -v "http://127.0.0.1:4646/v1/client/fs/logs/qwerqwera"; echo
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 4646 (#0)
> GET /v1/client/fs/logs/qwerqwera HTTP/1.1
> Host: 127.0.0.1:4646
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error
< Vary: Accept-Encoding
< Vary: Origin
< Date: Fri, 04 Oct 2019 19:47:29 GMT
< Content-Length: 22
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host 127.0.0.1 left intact
must provide task name
```

After
```
$ curl -v "http://127.0.0.1:4646/v1/client/fs/logs/qwerqwera"; echo
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 4646 (#0)
> GET /v1/client/fs/logs/qwerqwera HTTP/1.1
> Host: 127.0.0.1:4646
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Vary: Accept-Encoding
< Vary: Origin
< Date: Fri, 04 Oct 2019 19:49:18 GMT
< Content-Length: 22
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host 127.0.0.1 left intact
must provide task name
```
2019-10-04 16:33:58 -04:00
Mahmood Ali e1fbe94457 upgrade go-plugin to latest, 8091134
Upgrade go-plugin to latest to pick up Windows fix in
https://github.com/hashicorp/go-plugin/pull/125 .
2019-10-04 13:26:49 -04:00
Mahmood Ali bb730d3ea7 api: declare websocket as a dependency
`github.com/gorilla/websocket` was declared in `vendor/vendor.json` but
not in the API go module manifest.
2019-10-04 11:57:29 -04:00
Mahmood Ali b77fd8654b cli: recover from client ACL lookup failures
This fixes a bug in the CLI handling of node lookup failures when
querying allocation and FS endpoints.

Allocation and FS endpoint are handled by the client; one can query the
relevant client directly, or query a server to have it forwarded
transparently to relevant client.  Querying the client directly is
benefecial to avoid loading servers with IO.

As an optimization, the CLI attempts to query the client directly, but
then falls back to using server forwarding path if it encounters network
or connection errors (e.g. clients are locked down or in a separate
inaccessible network).

Here, we fix a bug where if the CLI fails to find to lookup the client
details because it lacks ACL capability or other unexpected reasons, the
CLI will not go through fallback path.
2019-10-04 11:23:59 -04:00
Buck Doyle 5da134d074
UI: Change Mirage data to be stable in development (#6389)
This sets a default-but-query-configurable Faker seed in development,
via faker-seed. It also changes uses of Math.random to use Faker’s
randomness so auto-generated data remains stable in development.
2019-10-03 09:13:08 -05:00
Daniel Dreier 5d7b06e6ee docs: Add missing double-quote (#6418)
The missing quote broke syntax highlighting.
2019-10-02 19:58:10 -05:00
Michael Lange 9f671dda43 Copy changes from review 2019-10-02 16:54:38 -07:00
Omar Khawaja 073fbb2daa
specify token given to consul template as periodic and orphan (#6148) 2019-10-02 12:52:10 -04:00
Nick Ethier 0c19bf6f04
executor: run exec commands in netns if set (#6405)
executor: run exec commands in netns if set
2019-10-01 14:45:43 -04:00
Drew Bailey f4df5592df
Merge pull request #6395 from hashicorp/b-missing-vault-sercret
Use joint context to cancel prestart hooks
2019-10-01 07:07:17 -07:00
Nick Ethier 8b881d83d5
executor: rename wrapNetns to withNetworkIsolation 2019-09-30 21:38:31 -04:00
Drew Bailey 69eebcd241
simplify logic to check for vault read event
defer shutdown to cleanup after failed run

Co-Authored-By: Michael Schurter <mschurter@hashicorp.com>

update comment to include ctx note for shutdown
2019-09-30 11:02:14 -07:00
Drew Bailey 7565b8a8d9
Use joint context to cancel prestart hooks
fixes https://github.com/hashicorp/nomad/issues/6382

The prestart hook for templates blocks while it resolves vault secrets.
If the secret is not found it continues to retry. If a task is shutdown
during this time, the prestart hook currently does not receive
shutdownCtxCancel, causing it to hang.

This PR joins the two contexts so either killCtx or shutdownCtx cancel
and stop the task.
2019-09-30 10:48:01 -07:00
Preetha 0bf4a2ea38
Merge pull request #6404 from hashicorp/docs-nomad-index
clarify index starting value for blocking queries
2019-09-30 11:41:20 -05:00
Nick Ethier 5127caef11
comment wrapNetns 2019-09-30 12:06:52 -04:00
Nick Ethier 67ac161565
executor: removed unused field from exec_utils.go 2019-09-30 11:57:34 -04:00