Commit Graph

115 Commits

Author SHA1 Message Date
Michael Schurter
5192cdd8d2 Initializing embedded structs is weird 2017-08-17 16:49:14 -07:00
Michael Schurter
e0ea41e774 Test createCheckReg 2017-08-17 16:49:14 -07:00
Michael Schurter
947516405a Add Header and Method support for HTTP checks 2017-08-17 16:44:21 -07:00
Alex Dadgar
06b1044cfe Fix integration test 2017-08-14 10:52:49 -07:00
Alex Dadgar
f49c026438 Merge pull request #2984 from hashicorp/b-tags
Fix alloc health with checks using interpolation
2017-08-10 13:07:25 -07:00
Alex Dadgar
4d323e14df Address comments 2017-08-10 13:07:08 -07:00
Alex Dadgar
3b300925a2 Fix alloc health with checks using interpolation
Fixes an issue in which the allocation health watcher was checking for
allocations health based on un-interpolated services and checks. Change
the interface for retrieving check information from Consul to retrieving
all registered services and checks by allocation. In the future this
will allow us to output nicer messages.

Fixes https://github.com/hashicorp/nomad/issues/2969
2017-08-07 16:27:08 -07:00
Luke Farnell
7a56971508 fixed all spelling mistakes for goreport 2017-08-07 17:13:05 -04:00
Michael Schurter
c075349a33 Use int32 for atomic ops to avoid alignment issues
From https://golang.org/pkg/sync/atomic/#pkg-note-BUG :

On both ARM and x86-32, it is the caller's responsibility to arrange for
64-bit alignment of 64-bit words accessed atomically. The first word in
a global variable or in an allocated struct or slice can be relied upon
to be 64-bit aligned.
2017-08-04 10:14:16 -07:00
Michael Schurter
e04267da4f Fix comment 2017-07-25 12:13:05 -07:00
Michael Schurter
9a3f6af77e Forgot to setcmdenv
This would leak a consul agent
2017-07-25 12:09:57 -07:00
Michael Schurter
4666d85a29 Use seen more conservatively 2017-07-24 16:48:40 -07:00
Michael Schurter
8e5d95df08 Always increment failures...
...as it's used in calculating the backoff
2017-07-24 15:37:53 -07:00
Michael Schurter
82ea86fb6f Track whether Consul has ever been seen
Need a way to squelch Consul operation errors on shutdown. If it's never
been seen don't log errors about deregs failing.
2017-07-24 12:12:02 -07:00
Michael Schurter
b01a00a7f3 Synchronously deregister agent on shutdown
Fixes #2891

Previously the agent services and checks were being asynchrously
deregistered on shutdown, so it was a race between the sync goroutine
deregistering them and Nomad shutting down.

This switches to synchronously deregister agent serivces and checks
which doesn't really have a downside since the sync goroutines retry
behavior doesn't help on shutdown anyway.
2017-07-24 11:40:37 -07:00
Alex Dadgar
08c2ba9bc6 Parallel client tests (#2890)
* alloc_runner

* Random tests

* parallel task_runner and no exec compatible check

* Parallel client

* Fail fast and use random ports

* Fix docker port mapping

* Make concurrent pull less timing dependant

* up parallel

* Fixes

* don't build chroots in parallel on travis

* Reduce parallelism on travis with lxc/rkt

* make java test app not run forever

* drop parallelism a little

* use docker ports that are out of the os's ephemeral port range

* Limit even more on travis

* rkt deadline
2017-07-22 19:04:36 -07:00
Alex Dadgar
bce1acef0a remove root requirement on consul integration check 2017-07-21 19:32:41 -07:00
Michael Schurter
b124a92bc8 Error -> Errof 2017-07-19 10:00:57 -07:00
Michael Schurter
a83d6f996e Never remove unknown agent services
Fixes #2827

This is a tradeoff. The pro is that you can run separate client and
server agents on the same node and advertise both. The con is that if a
Nomad agent crashes and isn't restarted on that node in the same mode
its entry will not be cleaned up.

That con scenario seems far less likely to occur than the scenario on
the pro side, and even if we do leak an agent entry the checks will be
failing so nothing should attempt to use it.
2017-07-18 13:23:01 -07:00
Alex Dadgar
38e50eedb1 check id method name changed 2017-07-07 12:15:09 -07:00
Alex Dadgar
f72bbaa370 Client watches for allocation health using task state and Consul checks
This PR adds watching of allocation health at the client. The client can
watch for health based on the tasks running on time and also based on
the consul checks passing.
2017-07-07 12:10:04 -07:00
Michael Schurter
85860dcb67 Fix test error formats 2017-06-26 12:53:43 -07:00
Michael Schurter
a464ca3287 Remove debug logging 2017-06-21 17:19:08 -07:00
Michael Schurter
4117c8b3a2 Fix Service.AddressMode changes during task updates 2017-06-21 17:19:08 -07:00
Michael Schurter
8a7df57227 Test driver network advertisement and checks 2017-06-21 17:19:08 -07:00
Michael Schurter
3fddb05fc8 Implement DriverNetwork and Service.AddressMode
Ideally DriverNetwork would be fully populated in Driver.Prestart, but
Docker doesn't assign the container's IP until you start the container.

However, it's important to setup the port env vars before calling
Driver.Start, so Prestart should populate that.
2017-06-21 17:19:08 -07:00
Michael Schurter
70fdc46abc Merge pull request #2591 from hashicorp/b-2180-script-updates
Properly interpolate services on updated tasks
2017-05-17 09:09:01 -07:00
Alex Dadgar
e47be9f771 Merge branch 'master' into f-bolt-db 2017-05-09 11:11:55 -07:00
Michael Schurter
78af600070 Update consul/api to support unix socket addrs
Fixes #2594
2017-05-08 11:57:04 -07:00
Alex Dadgar
3642434293 Fix tests 2017-05-03 15:14:19 -07:00
Alex Dadgar
646fd8a2f9 Fix tests 2017-05-03 12:38:49 -07:00
Michael Schurter
92535496b4 Properly interpolate services on updated tasks
Previously was interpolating the original task's services again.

Fixes #2180

Also fixes a slight memory leak in the new consul agent. Script check
handles weren't being deleted after cancellation.
2017-04-26 11:22:01 -07:00
Michael Schurter
58430bf062 Fix consul test build on Windows 2017-04-19 16:14:11 -07:00
Michael Schurter
b9ea2765ec Thanks go vet! 2017-04-19 13:05:41 -07:00
Michael Schurter
4cf34edb29 Skip checks with TLSSkipVerify if it's unsupported
Fixes #2218
2017-04-19 12:45:34 -07:00
Michael Schurter
6d9e61bb51 Use spiffy new Go 1.8 subtest feature 2017-04-19 12:42:48 -07:00
Michael Schurter
5948daf4f7 Forgot an important word 2017-04-19 12:42:48 -07:00
Michael Schurter
346838381b Only register HTTPS agent check when Consul>=0.7.2
Support for TLSSkipVerify in other checks coming soon!
2017-04-19 12:42:48 -07:00
Michael Schurter
f0bec63174 Explain weird timer logic 2017-04-19 12:42:48 -07:00
Michael Schurter
de3d78365e Metricsify new Consul client 2017-04-19 12:42:48 -07:00
Michael Schurter
d3f3af8bf9 Always fail script checks when deadline exceeded 2017-04-19 12:42:48 -07:00
Michael Schurter
465cc5157b Test script check exit codes 2017-04-19 12:42:47 -07:00
Michael Schurter
6a56b0efc6 Follow _testing.go convention for testing tools 2017-04-19 12:42:47 -07:00
Michael Schurter
927b265854 Rework to account for ports not being in IDs
Previous implementation assumed all struct fields were included in
service and check IDs. Service IDs never include port labels and check
IDs *optionally* include port labels, so lots of things had to change.

Added a really big test to exercise this.
2017-04-19 12:42:47 -07:00
Michael Schurter
7de3adaf87 Remove commits return value
...and still protect against leaking agent entries in Consul on
shutdown.
2017-04-19 12:42:47 -07:00
Michael Schurter
5d75efc397 Explain PortLabel handling in RegisterAgent 2017-04-19 12:42:47 -07:00
Michael Schurter
48269c36b0 Plumb alloc id + task name into script check logs 2017-04-19 12:42:47 -07:00
Michael Schurter
80617a9c1a Stop being lazy and just type out struct{}{} 2017-04-19 12:42:47 -07:00
Michael Schurter
7ac9215fb7 Use nifty testtask sleep command for xplat compat 2017-04-19 12:42:47 -07:00
Michael Schurter
4002d87a6b Add comments, clarify names, fix PR comments 2017-04-19 12:42:47 -07:00