Commit Graph

14571 Commits

Author SHA1 Message Date
Michael Schurter 77f99fc49c
Merge pull request #5510 from hashicorp/b-docker-stats
docker: fix send after close panic in stats
2019-04-02 10:01:28 -07:00
Michael Schurter fc5487dbbc executor/linux: add defensive checks to binary path 2019-04-02 09:40:53 -07:00
Michael Schurter ff639f9ccc docker: improve stats names and comments 2019-04-02 09:18:38 -07:00
Mahmood Ali e2723399f3
Update drivers/docker/stats.go comment
Co-Authored-By: schmichael <michael.schurter@gmail.com>
2019-04-02 09:09:17 -07:00
Michael Schurter df3467a6ce docker: fix send after close panic in stats
destCh was being written to by one goroutine and closed by another
goroutine. This panic occurred in Travis:

```
=== FAIL: drivers/docker TestDockerCoordinator_ConcurrentPulls (117.66s)
=== PAUSE TestDockerCoordinator_ConcurrentPulls
=== CONT  TestDockerCoordinator_ConcurrentPulls

panic: send on closed channel

goroutine 5358 [running]:
github.com/hashicorp/nomad/drivers/docker.dockerStatsCollector(0xc0003a4a20, 0xc0003a49c0, 0x3b9aca00)
	/home/travis/gopath/src/github.com/hashicorp/nomad/drivers/docker/stats.go:108 +0x167

created by
github.com/hashicorp/nomad/drivers/docker.TestDriver_DockerStatsCollector
	/home/travis/gopath/src/github.com/hashicorp/nomad/drivers/docker/stats_test.go:33 +0x1ab
```

The 2 ways to fix this kind of error are to either (1) add extra
coordination around multiple goroutines writing to a chan or (2) make it
so only one goroutines writes to a chan.

I implemented (2) first as it's simpler, but @notnoop pointed out since
the same destCh in reused in the stats loop there's now a double close
panic possible!

So this implements (1) by adding a *usageSender struct for handling
concurrent senders and closing.
2019-04-02 08:28:08 -07:00
Mahmood Ali dcc6ad7eda
Merge pull request #5508 from hashicorp/d-docker-force-pull-latest
document force_pull and :latest tag interaction
2019-04-02 09:37:55 -04:00
Mahmood Ali accf290d74 document force_pull and :latest tag interaction 2019-04-02 08:48:34 -04:00
Preetha Appan 19b4bb7ec3
added cpu/disk/memory stress jobs for e2e tests 2019-04-01 22:28:18 -05:00
Michael Schurter 7d49bc4c71 executor/linux: make chroot binary paths absolute
Avoid libcontainer.Process trying to lookup the binary via $PATH as the
executor has already found where the binary is located.
2019-04-01 15:45:31 -07:00
Mahmood Ali c16b7ac316
Merge pull request #5499 from hashicorp/r-fifo-plain-file
fifo: Use plain fifo file in Unix
2019-04-01 17:23:11 -04:00
Mahmood Ali cb16ad7e3f comment configureTLogging 2019-04-01 16:52:58 -04:00
Mahmood Ali 81f4f07ed7 rename fifo methods for clarity 2019-04-01 16:52:58 -04:00
Mahmood Ali e87afe465b clarify closeDone blocking and field name 2019-04-01 16:10:34 -04:00
Preetha Appan 007d771174
Added nginx to e2e test 2019-04-01 14:52:58 -05:00
Mahmood Ali 9d647713c0 no requires in a test goroutine 2019-04-01 15:38:39 -04:00
Michael Lange 6d016ed5f0
Merge pull request #5496 from hashicorp/b-ui/reattach-resources-to-stats-trackers
UI: Reattach resources to stats trackers in the event they were destroyed
2019-04-01 11:31:28 -07:00
Mahmood Ali 88dc4a255a avoid opening files just to close them 2019-04-01 13:24:18 -04:00
Mahmood Ali dac2cd3df3 Add test cases for waiting on children
Also, make the test use files just like in the non-test case.
2019-04-01 13:24:18 -04:00
Mahmood Ali 2b1f858e1b log when fifo fails to open 2019-04-01 13:18:03 -04:00
Mahmood Ali 54209489ef run fifo tests on Windows 2019-04-01 13:18:03 -04:00
Mahmood Ali 967452a3f0 fifo: Use plain fifo file in Unix
This PR switches to using plain fifo files instead of golang structs
managed by containerd/fifo library.

The library main benefit is management of opening fifo files.  In Linux,
a reader `open()` request would block until a writer opens the file (and
vice-versa).  The library uses goroutines so that it's the first IO
operation that blocks.

This benefit isn't really useful for us: Given that logmon simply
streams output in a separate process, blocking of opening or first read
is effectively the same.

The library additionally makes further complications for managing state
and tracking read/write permission that seems overhead for our use,
compared to using a file directly.

Looking here, I made the following incidental changes:
* document that we do handle if fifo files are already created, as we
rely on that behavior for logmon restarts
* use type system to lock read vs write: currently, fifo library returns
`io.ReadWriteCloser` even if fifo is opened for writing only!
2019-04-01 13:18:03 -04:00
Mahmood Ali b1666e6c8a
Merge pull request #5497 from hashicorp/b-exec-cpu-stats
exec: report cpu usage summary stat
2019-04-01 12:37:01 -04:00
Preetha Appan a262be08e7
Remove unnecessary step in getting node client
All allocation stats are routable from the server
2019-04-01 10:45:41 -05:00
Danielle Tomlinson 803e1a8b86 acl: Add alloc-lifecycle namespace capability
This capability will gate access to features that allow interacting with
a running allocation, for example, signalling, stopping, and rescheduling
specific allocations.
2019-04-01 11:35:09 +02:00
Mahmood Ali 2648d4176c
Merge pull request #5468 from hashicorp/b-test-exec-kill-wait
Adding tests for killing task without grace
2019-03-31 20:37:15 -04:00
Michael Schurter b8d1dd95a0
Update drivers/shared/executor/executor_test.go
Co-Authored-By: notnoop <mahmood@notnoop.com>
2019-03-31 20:34:24 -04:00
Preetha Appan f9019ae605
Add e2e test with raw exec job for verifying allocation resource stats 2019-03-31 09:46:23 -05:00
Mahmood Ali 0c8ee8c404 Simplify proto conversion and handle swap
Convert all cpu and memory usage fields regardless of stated measured
fields, and handle swap fields
2019-03-30 15:18:28 -04:00
Mahmood Ali f4a68f556f deserialize total ticks 2019-03-30 07:14:57 -04:00
Mahmood Ali 9656d79eba Always report TotalTicks when percent is measured
Fix a case where TotalTicks doesn't get serialized across executor grpc
calls.

Here, I opted to implicit add field, rather than explicitly mark it as a
measured field, because it's a derived field and to preserve 0.8
behavior where total ticks aren't explicitly marked as a measured field.
2019-03-29 22:34:28 -04:00
Michael Lange 5bfd1d0ddd Reattach resources to stats trackers in the event they were destroyed 2019-03-29 16:09:14 -07:00
Michael Schurter 3b72db6e26
Merge pull request #5491 from hashicorp/b-docker-container-name
docker: restore pre-0.9 container names
2019-03-29 15:41:04 -07:00
Michael Schurter 294d405397 docker: restore pre-0.9 container names
As far as I can tell Nomad itself does not use the container name after
container creation, so this should be safe.

OP: https://groups.google.com/d/topic/nomad-tool/kYkyERfVRXE/discussion
v0.8.7 code: https://github.com/hashicorp/nomad/blob/v0.8.7/client/driver/docker.go#L1530-L1531
2019-03-29 13:55:43 -07:00
Jeff Mitchell 8da6684568
Add go.mod/go.sum (#5493) 2019-03-29 15:02:32 -04:00
Jeff Mitchell 13dab7dd24
Divest api/ package of deps elsewhere in the nomad repo. (#5488)
* Divest api/ package of deps elsewhere in the nomad repo.

This will allow making api/ a module without then pulling in the
external repo, leading to a package name conflict.

This required some migration of tests to an apitests/ folder (can be
moved anywhere as it has no deps on it). It also required some
duplication of code, notably some test helpers from api/ -> apitests/
and part (but not all) of testutil/ -> api/testutil/.

Once there's more separation and an e.g. sdk/ folder those can be
removed in favor of a dep on the sdk/ folder, provided the sdk/ folder
doesn't depend on api/ or /.

* Also remove consul dep from api/ package

* Fix stupid linters

* Some restructuring
2019-03-29 14:47:40 -04:00
Preetha 43270647c2
Merge pull request #5480 from hashicorp/docs-centos6
docs: mention support for centos6 is dropped
2019-03-29 09:21:08 -05:00
Preetha e4139b00bf
Merge pull request #5489 from hashicorp/b-plugin-config-bugfix
Fix json parsing bug with plugins that don't provide args
2019-03-29 09:13:26 -05:00
Preetha Appan 71e6550f81
Address review comments 2019-03-29 08:57:49 -05:00
Preetha Appan e0566237a4
fix linting 2019-03-28 18:01:40 -05:00
Preetha Appan cc07256bb5
Fix json parsing bug with plugins that don't provide args
This fixes a bug with JSON agent configuration parsing where the AST
for the plugin stanza had unnecessary flattening originating from hcl parsing
library. The workaround fixes the AST by popping off the flattened element and wrapping
it in a list. The workaround comes from similar code in terraform.

There were no existing test cases for json parsing so I added a few.
2019-03-28 16:33:30 -05:00
Preetha 24d3d723a8
Merge pull request #5478 from hashicorp/b-e2e_metrics
Use specific url prefix for metrics test
2019-03-27 22:17:15 -05:00
Michael Schurter a91d590503 docs: mention support for centos6 is dropped 2019-03-27 11:21:16 -07:00
Preetha Appan dc370d2e6f
Use specific url prefix for metrics test
Also changed the output to show client node IP addresses
2019-03-27 11:04:06 -05:00
Michael Schurter 2636df1877
Merge pull request #5474 from briancain/fix-mixed-intend
Fixup mixed tabs in script for Vagrantfile demo
2019-03-27 07:18:31 -07:00
Brian Cain 5d129e1368
Fixup mixed tabs in script for Vagrantfile demo
This commit replaces a hard tab with two spaces to match the intendation
of the rest of the defined script
2019-03-26 15:23:38 -07:00
Preetha f9bd698801
Merge pull request #5473 from hashicorp/f-spread-docs-fix
minor fixes to spread stanza documentation
2019-03-26 17:13:43 -05:00
Preetha Appan bd2e6b5bf9
minor fixes to spread stanza documentation 2019-03-26 15:01:56 -05:00
Mahmood Ali df5d7ba50d fix test setup 2019-03-26 09:15:22 -04:00
Mahmood Ali d737a9836a test kill wait 2019-03-26 09:15:22 -04:00
Mahmood Ali b2b7618a1c
clarify unknown signal log line (#5466) 2019-03-25 17:19:43 -04:00