Commit Graph

19806 Commits

Author SHA1 Message Date
Tim Gross 1fb1c9c5d4
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 8aacab513b
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 059e87c862
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 344e821ace
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 f3dcefe5a9
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 d3a17b5c82 address review feedback 2020-10-22 11:49:37 -04:00
davidr912 3319269964
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 9c0a93a604 Don't parse the server-set fields of the job struct 2020-10-22 08:18:57 -04:00
Tim Gross 8459f1ead5
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 f52bda4c30 api: update /render api to parse hclv2 2020-10-21 15:46:57 -04:00
Mahmood Ali 84ec0b38e8 cli: use HCLv2 parser
Also, fallback to using HCLv1.
2020-10-21 15:46:57 -04:00
Mahmood Ali f9290090e0 Update vendored libraries 2020-10-21 15:46:56 -04:00
Mahmood Ali b3c118ae22 Add hclv2 parser 2020-10-21 15:46:56 -04:00
Tim Gross 7eeb46fb5d bump website version to 0.12.6 2020-10-21 14:34:12 -04:00
Tim Gross 70c9faabd2 upgrade guide documentation 2020-10-21 14:34:12 -04:00
Tim Gross 07fba1c92c changelog entry 2020-10-21 14:34:12 -04:00
Tim Gross 6df36e4cdb 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 1ae924973e 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 618388d1c3 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 58df967c3a Tag Job spec with HCLv2 tags 2020-10-21 14:05:46 -04:00
Tim Gross 9fa38bac98
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 9b8d10875b
changelog entry for #9093 (#9132) 2020-10-20 16:20:23 -04:00
Alexander Shtuchkin 90fd8bb85f
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 3da633bd41
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 59acc1ca1d docs: update changelog for canary meta 2020-10-20 12:54:30 -05:00
Seth Hoenig 9cdb98f0e4 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 8a0ef606a3 Add interpolation on service canarymeta 2020-10-20 12:45:36 -05:00
Seth Hoenig 9ac5592b13
Merge pull request #9127 from josemaia/patch-2
Remove limitation that has been fixed
2020-10-20 12:17:29 -05:00
Buck Doyle c8caa810e9
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 0478a50881
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 186d85fd34
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 8451de99b2
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 37273def9c
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 3682851caa
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 6c788fdccd
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 1f215e47d4
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 5fc9e74ba7 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 8e4df4ca51 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 17e14b79ac
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 da75edc42f
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 ef5eabc79a
Merge pull request #9105 from hashicorp/d/topo-changelog
Changelog entry for topo viz
2020-10-16 09:29:34 -07:00
Tim Gross ced132199d improve language for LXC volumes 2020-10-16 11:40:06 -04:00
Tim Gross fbf98543f2 clarify raw_exec doesn't have filesystem isolation 2020-10-16 11:38:23 -04:00
Drew Bailey ea6fcf5f4e
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 8fb55a2148 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 a3561a3d96 fix anchor links 2020-10-16 11:02:49 -04:00
Tim Gross 5c4fdd006c 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 8fcdbe0592
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 54d7f57662
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
Tim Gross e0ff06be2f
e2e: networking test job needs to outlast assert (#9113)
The `e2ejob` utility asserts that a job is running for 5s, but with a sleep
time of 5s, the networking job can race with that check. Sleeping for a longer
period should guarantee that we're running long enough to pass the assert.

Also constrains the job to Linux because our Windows test targets don't yet
support Docker (LCOW), and expand the set of DCs we can safely land on.
2020-10-16 10:13:16 -04:00