Commit Graph

19807 Commits

Author SHA1 Message Date
Tim Gross
9e9dac4a2c Revert "e2e: fix destination of templates in VaultSecrets test (#9146)" (#9163)
This reverts commit 8aed53c177.
2020-10-23 09:01:25 -04:00
Tim Gross
8a90b7eb16 artifact/template: make destination path absolute inside taskdir (#9149)
Prior to Nomad 0.12.5, you could use `${NOMAD_SECRETS_DIR}/mysecret.txt` as
the `artifact.destination` and `template.destination` because we would always
append the destination to the task working directory. In the recent security
patch we treated the `destination` absolute path as valid if it didn't escape
the working directory, but this breaks backwards compatibility and
interpolation of `destination` fields.

This changeset partially reverts the behavior so that we always append the
destination, but we also perform the escape check on that new destination
after interpolation so the security hole is closed.

Also, ConsulTemplate test should exercise interpolation
2020-10-22 15:47:49 -04:00
Buck Doyle
5237c11817 Add logged Faker seed when none is set in tests (#9140)
This will hopefully make it easier to reproduce test failures
that happen intermittently, especially in CI.
2020-10-22 13:45:51 -05:00
Mahmood Ali
ec3650fe17 Merge pull request #9142 from hashicorp/f-hclv2-2.3
Support HCLv2 for Nomad jobs
2020-10-22 12:26:28 -05:00
Tim Gross
8aed53c177 e2e: fix destination of templates in VaultSecrets test (#9146)
The `$NOMAD_SECRETS_DIR` environment variable is rendered as `/secrets`, which
prior to the recent security patch would unintentionally escape the file
sandbox and get dropped in a directory named `/secrets` where the Nomad client
binary was running. The `VaultSecrets` test was accidentally relying on this
behavior and that causes the test to fail.
2020-10-22 13:00:08 -04:00
Drew Bailey
3347b40d11 remove event durability (#9147)
* remove event durability

temporarily removing go-memdb event durability until a new strategy is developed on how to best handled increased durability needs

* drop events table schema and state store methods

* fix neweventbuffer invocations
2020-10-22 12:21:03 -04:00
Mahmood Ali
93bbe181e0 address review feedback 2020-10-22 11:49:37 -04:00
davidr912
ca1cb4b484 Update job/plan documentation (#9145)
Updated to reflect plan expects the job definition as JSON object and not as the string form of the JSON
2020-10-22 10:17:47 -04:00
Mahmood Ali
4d76e8bd79 Don't parse the server-set fields of the job struct 2020-10-22 08:18:57 -04:00
Tim Gross
fc1b0c11e6 csi: prevent in-use plugin GC from blocking volume GC (#9141)
During CSI plugin GC, we don't return an error if the volume is in use,
because this is not an error condition. If we were to return an error during a
`nomad system gc`, we would not continue on to GC volumes.

But check for the specific error message fails if the GC is performed on a
worker rather than on the leader, due to RPC forwarding wrapping the error
message. Use a less specific test so that we don't return an error.
2020-10-21 16:54:28 -04:00
Mahmood Ali
9fe7423403 api: update /render api to parse hclv2 2020-10-21 15:46:57 -04:00
Mahmood Ali
1d85c6a4eb cli: use HCLv2 parser
Also, fallback to using HCLv1.
2020-10-21 15:46:57 -04:00
Mahmood Ali
034733cdc9 Update vendored libraries 2020-10-21 15:46:56 -04:00
Mahmood Ali
7fb6bc3941 Add hclv2 parser 2020-10-21 15:46:56 -04:00
Tim Gross
8c7ccb2d49 bump website version to 0.12.6 2020-10-21 14:34:12 -04:00
Tim Gross
19b1ca9b4f upgrade guide documentation 2020-10-21 14:34:12 -04:00
Tim Gross
dc451b324f changelog entry 2020-10-21 14:34:12 -04:00
Tim Gross
076db2ef6b artifact/template: prevent file sandbox escapes
Ensure that the client honors the client configuration for the
`template.disable_file_sandbox` field when validating the jobspec's
`template.source` parameter, and not just with consul-template's own `file`
function.

Prevent interpolated `template.source`, `template.destination`, and
`artifact.destination` fields from escaping file sandbox.
2020-10-21 14:34:12 -04:00
Mahmood Ali
2a9232902c hclv1: tweak HCLv1 tests
This ensures that gatway ReadOnly key is tested.  Also, update the hclv1
test-fixtures to be hclv1 compliant.
2020-10-21 14:05:46 -04:00
Mahmood Ali
922b671719 api: parse service gateway name
Adding gateway name eases HCLv2 parsing. This field is only used for parsing the
job and is ignored for any other pruposes
2020-10-21 14:05:46 -04:00
Mahmood Ali
589a9e995d Tag Job spec with HCLv2 tags 2020-10-21 14:05:46 -04:00
Tim Gross
d552b4e8d1 e2e: path fixes for local_binary uploads (#9137)
When uploading a local binary for provisioning, the location that we pass into
the provisioning script needs to be where we uploaded it to, not the source on
our laptop. Also, the null_resource for uploading needs to read in the private
key, not its path.
2020-10-21 10:20:22 -04:00
Tim Gross
f6ca24c624 changelog entry for #9093 (#9132) 2020-10-20 16:20:23 -04:00
Alexander Shtuchkin
1be5243d08 Implement 'batch mode' for persisting allocations on the client. (#9093)
Fixes #9047, see problem details there.

As a solution, we use BoltDB's 'Batch' mode that combines multiple
parallel writes into small number of transactions. See
https://github.com/boltdb/bolt#batch-read-write-transactions for
more information.
2020-10-20 16:15:37 -04:00
Seth Hoenig
fe8ffd0762 Merge pull request #9130 from hashicorp/b-canarymeta-interpolation-tests
consul: add tests for meta/canarymeta interpolation
2020-10-20 14:45:06 -05:00
Seth Hoenig
25dd3cccf1 docs: update changelog for canary meta 2020-10-20 12:54:30 -05:00
Seth Hoenig
3b55c2fc01 client: add tests around meta and canarymeta interpolation
Expanding on #9096, add tests for making sure service.Meta and
service.CanaryMeta are interpolated from environment variables.
2020-10-20 12:50:29 -05:00
Jorge Marey
bb8f239fc7 Add interpolation on service canarymeta 2020-10-20 12:45:36 -05:00
Seth Hoenig
16f634f1fc Merge pull request #9127 from josemaia/patch-2
Remove limitation that has been fixed
2020-10-20 12:17:29 -05:00
Buck Doyle
7c7b1131f0 Remove logo spin for prefers-reduced-motion (#9128)
Spinning is one of the triggers mentioned on this page:
https://webkit.org/blog/7551/responsive-design-for-motion/

Thanks to @fivetanley for mentioning that this exists.
2020-10-20 11:52:15 -05:00
Seth Hoenig
f14c898958 Merge pull request #9118 from hashicorp/f-use-upstream-gopsutil-again
deps: use upstream gopsutil once more
2020-10-20 10:30:44 -05:00
José Maia
217902cf9e Remove limitation that has been fixed
Issue #6459 has been fixed for a while, but the docs still point to it as a limitation
2020-10-20 15:32:41 +01:00
Drew Bailey
659943a18b adds two base event stream e2e tests (#9126)
* adds two base event stream e2e tests

test evaluation filter keys are included

* Apply suggestions from code review

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* gc aftereach

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2020-10-20 08:26:21 -04:00
Seth Hoenig
cf9a86f1db Merge pull request #9119 from hashicorp/f-update-gomod-1.15
build: update gomod go version
2020-10-19 14:36:19 -05:00
Tim Gross
1c3c24210a update tree tool to pass lint-go (#9125)
* update `tree` tool to pass lint-go
* bump `tools/go.mod` to go1.15
2020-10-19 15:33:56 -04:00
Drew Bailey
7ce0b5017c Events/msgtype cleanup (#9117)
* use msgtype in upsert node

adds message type to signature for upsert node, update tests, remove placeholder method

* UpsertAllocs msg type test setup

* use upsertallocs with msg type in signature

update test usage of delete node

delete placeholder msgtype method

* add msgtype to upsert evals signature, update test call sites with test setup msg type

handle snapshot upsert eval outside of FSM and ignore eval event

remove placeholder upsertevalsmsgtype

handle job plan rpc and prevent event creation for plan

msgtype cleanup upsertnodeevents

updatenodedrain msgtype

msg type 0 is a node registration event, so set the default  to the ignore type

* fix named import

* fix signature ordering on upsertnode to match
2020-10-19 09:30:15 -04:00
Mahmood Ali
b4034d6cf7 Merge pull request #9109 from benbuzbee/gopath-proto
Use GOPATH/src explicitly in proto build target
2020-10-18 18:21:31 -05:00
Seth Hoenig
dbf1390571 build: update gomod go version
Keep go.mod go version up to date with the version of Go used
to build Nomad.
2020-10-17 09:04:33 -05:00
Seth Hoenig
10cc366305 deps: use upstream gopsutil once more
The PR we needed https://github.com/shirou/gopsutil/pull/889 has been merged
upstream, which means we can use upstream rather than our fork of psutil.
2020-10-17 08:54:50 -05:00
Tim Gross
799d3e7df7 docs: clarify task working directories (#9098)
The terms task directory and allocation directory are used throughout the
documentation but these directories are not the same as the `NOMAD_TASK_DIR`
and `NOMAD_ALLOC_DIR` locations. This is confusing when trying to use the
`template` and `artifact` stanzas, especially when trying to use a destination
outside the Nomad-mounted directories for Docker and similar drivers.

This changeset introduces "allocation working directory" to mean the location
on disk where the various directories and artifacts are staged, and "task
working directory" for the task. Clarify how specific task drivers interact
with the task working directory.

Co-authored-by: Charlie Voiselle <464492+angrycub@users.noreply.github.com>
2020-10-16 12:56:09 -04:00
Tim Gross
ec67d8150e Update website/pages/docs/drivers/external/lxc.mdx
Co-authored-by: Charlie Voiselle <464492+angrycub@users.noreply.github.com>
2020-10-16 12:55:45 -04:00
Michael Lange
ce9e5d50fb Merge pull request #9105 from hashicorp/d/topo-changelog
Changelog entry for topo viz
2020-10-16 09:29:34 -07:00
Tim Gross
299b5b18ae improve language for LXC volumes 2020-10-16 11:40:06 -04:00
Tim Gross
daaf9ca558 clarify raw_exec doesn't have filesystem isolation 2020-10-16 11:38:23 -04:00
Drew Bailey
e49bd2e33e Events/docs (#9100)
* /v1/event/stream docs

* events sidebar

* wip server config

* make ids match

* fix typo

* add server config opts

* Update website/pages/api-docs/events.mdx

Co-authored-by: Seth Hoenig <shoenig@hashicorp.com>

* Update website/pages/api-docs/events.mdx

Co-authored-by: Seth Hoenig <shoenig@hashicorp.com>

* address feedback

Co-authored-by: Seth Hoenig <shoenig@hashicorp.com>
2020-10-16 11:23:47 -04:00
Tim Gross
25818cefbf Apply suggestions from code review
Co-authored-by: Charlie Voiselle <464492+angrycub@users.noreply.github.com>
2020-10-16 11:02:49 -04:00
Tim Gross
f3c7879dc7 fix anchor links 2020-10-16 11:02:49 -04:00
Tim Gross
75f269d08d docs: clarify task working directories
The terms task directory and allocation directory are used throughout the
documentation but these directories are not the same as the `NOMAD_TASK_DIR`
and `NOMAD_ALLOC_DIR` locations. This is confusing when trying to use the
`template` and `artifact` stanzas, especially when trying to use a destination
outside the Nomad-mounted directories for Docker and similar drivers.

This changeset introduces "allocation working directory" to mean the location
on disk where the various directories and artifacts are staged, and "task
working directory" for the task. Clarify how specific task drivers interact
with the task working directory.
2020-10-16 11:02:49 -04:00
Tim Gross
2b11e52fe9 e2e: add reporting to flaky spread test (#9115)
The spread test is infrequently flaky and it's hard to extract what's actually
happening. If the test fails, dump all the allocation metrics so that we can
debug the behavior.
2020-10-16 11:01:07 -04:00
Tim Gross
3e827ccb43 e2e: fix flaky TaskEventsTest (#9114)
Assert that we get at least N task events, rather than exactly N. When a
task within an allocation dies, a sibling task can get an Allocation Unhealthy
event after it's also killed, even though it's not the origin of the event.
2020-10-16 10:22:40 -04:00