Commit Graph

377 Commits

Author SHA1 Message Date
Michael Schurter
56f697580b Fix nil panic in Docker error condition
Fixes #2835

Yet another bug caused by overwriting container and then trying to
reference container.ID in the err handling block. Did a quick audit of
docker.go and it seems to be the last offender. See #2804 for previous
bug.
2017-07-14 10:48:19 -07:00
Michael Schurter
5ab252fe43 Merge pull request #2797 from hashicorp/f-2785-docker-bridge-ip
Add driver.docker.bridge_ip node attribute
2017-07-07 16:20:20 -07:00
Michael Schurter
024d5a8edc Remove debug logging 2017-07-07 16:19:42 -07:00
Michael Schurter
c47860f928 Don't panic in container list/remove/inspect race
Fixes #2802

While it's hard to reproduce the theoretical race is:

1. This goroutine calls ListContainers()
2. Another goroutine removes a container X
3. This goroutine attempts to InspectContainer(X)

However, this bug could be hit in the much simpler case of
InspectContainer() timing out.

In those cases an error is returned and the old code attempted to wrap
the error with the now-nil container.ID. Storing the container ID fixes
that panic.
2017-07-07 15:10:59 -07:00
Michael Schurter
38bf16d2ef Add driver.docker.bridge_ip node attribute
Fixes #2785
2017-07-07 10:14:10 -07:00
Michael Schurter
4f150e1650 Merge pull request #2786 from hashicorp/f-docker-auth-soft-fail
Default to auth hard fail but optionally soft fail
2017-07-06 13:25:56 -07:00
Michael Schurter
58186bfb88 Merge branch 'master' into master 2017-07-06 12:09:36 -07:00
Michael Schurter
3aae173432 Default to auth hard fail but optionally soft fail 2017-07-06 11:35:34 -07:00
Michael Schurter
c5e9c4b7b0 Merge pull request #2744 from aep/master
Do not fail when no docker registry auth is available
2017-07-06 11:04:11 -07:00
Arvid E. Picciani
1699761874 Do not fail when no docker registry auth is available
this amends the behaviour introduced with #2651
and allows pulling public images when docker.auth.helper is set
2017-06-27 11:11:18 +02:00
Michael Schurter
a70ad9b18c Style and comments 2017-06-23 15:20:04 -07:00
Michael Schurter
deffe5b816 Simplify Docker Networks processing 2017-06-21 17:19:08 -07:00
Michael Schurter
81b942ebb0 Bump error log level 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
Alex Dadgar
5e93d05161 Fix port map interpolation for docker
This PR fixes an issue in which the value of the portmap could not be
interpolated.

Fixes https://github.com/hashicorp/nomad/issues/2680
2017-06-08 13:12:32 -07:00
Alex Dadgar
d4d2d1f656 small cleanup 2017-05-31 15:56:54 -07:00
Ulrik Mikaelsson
20fd19d6e2 Implement support for docker-credential-helpers
Solves: #2334
2017-05-31 12:45:02 +02:00
Michael Schurter
a96fb5dbb0 Move task env into execcontext
Also inject PATH into rkt commands since we're no longer appending host
env vars for it.
2017-05-23 13:53:34 -07:00
Michael Schurter
6db35013d2 Add PortMap to struct returned by Driver.Prestart
Moves env.Builder out of drivers entirely so one less thing to worry
about when implementing driver plugins.
2017-05-23 13:53:34 -07:00
Michael Schurter
ace00980a1 Refactor TaskEnvironment into Builder and TaskEnv 2017-05-23 13:53:33 -07:00
Brandon Fulljames
b0304477a2 Add SecurityOpt as a config field in Docker driver 2017-05-19 16:18:49 -07:00
johannesa
bdfd0b4810 Fixed wrong newline 2017-05-17 16:51:22 +02:00
johannesa
b523069441 mac address pinning in docker driver
This commit adds mac address pining to the docker driver.
2017-05-17 16:41:00 +02:00
Michael Schurter
0e0845e94b Use a DriverAbility to expose Exec functionality 2017-04-19 12:42:47 -07:00
Michael Schurter
10cb924b2c Refactor Consul Syncer into new ServiceClient
Fixes #2478 #2474 #1995 #2294

The new client only handles agent and task service advertisement. Server
discovery is mostly unchanged.

The Nomad client agent now handles all Consul operations instead of the
executor handling task related operations. When upgrading from an
earlier version of Nomad existing executors will be told to deregister
from Consul so that the Nomad agent can re-register the task's services
and checks.

Drivers - other than qemu - now support an Exec method for executing
abritrary commands in a task's environment. This is used to implement
script checks.

Interfaces are used extensively to avoid interacting with Consul in
tests that don't assert any Consul related behavior.
2017-04-19 12:42:47 -07:00
Alex Dadgar
8d07bd8f9c Add ExtraHosts to Docker driver
This PR allows job submitters to add extra hosts to the containers
/etc/hosts file.

Fixes https://github.com/hashicorp/nomad/issues/2546
2017-04-11 10:52:41 -07:00
Clint Armstrong
5f4716b4ea Allow specifying container IP with docker driver 2017-04-07 11:56:07 -04:00
Michael Schurter
4d3c571859 Merge pull request #2482 from hashicorp/f-2289-better-artifact-err
Improve artifact download error message
2017-03-28 12:48:22 -07:00
Michael Schurter
76c909bc9e Add WrapRecoverable helper 2017-03-27 15:37:15 -07:00
Alex Dadgar
564367fa71 Proper reference counting through task restarts
This PR fixes an issue in which the reference count on a Docker image
would become inflated through task restarts.
2017-03-25 17:05:53 -07:00
Michael Schurter
774cb8dd9b Improve artifact download error message
Fixes #2289

Unfortunately took more RecoverableError hijinx than I would have liked.
There might be a better way.
2017-03-24 15:26:05 -07:00
Alex Dadgar
0e61a36564 return the recoverable err 2017-03-14 16:33:36 -07:00
Alex Dadgar
a6067d5667 Docker doesn't need to init the stats helper 2017-03-14 13:41:57 -07:00
Tom Michaud
6e561c7aa9 Fixes docker-driver docker.auth.config processing 2017-03-01 16:16:11 -07:00
Alex Dadgar
8e6d77ebd5 Fix caching of pull future 2017-02-28 18:19:13 -08:00
Alex Dadgar
07f7e19578 Fix vet script and fix vet problems
This PR fixes our vet script and fixes all the missed vet changes.

It also fixes pointers being printed in `nomad stop <job>` and `nomad
node-status <node>`.
2017-02-27 16:00:19 -08:00
Alex Dadgar
7b73e786cb Docker open stores image/image ID for next ID 2017-02-27 13:49:54 -08:00
Alex Dadgar
5338dafd51 Merge pull request #2361 from hashicorp/f-docker-coordination
Docker Image Coordinator and caching
2017-02-24 14:18:21 -08:00
Alex Dadgar
27b2c677c0 Docker Image Coordinator
This PR introduces a coordinator for doing CRUD on a Docker image. It
should fix racy deletion of images. The issue before was images would be
deleted between prestart and start causing an error.
2017-02-24 13:20:40 -08:00
Michael Schurter
d710c23d4d Put access to Docker volume drivers behind flag 2017-02-23 15:47:36 -08:00
Pietro Menna
5d29600341 Docker Volume Drivers
This commit adds the functionality to use Docker Volume Drivers.
2017-02-23 14:36:32 -03:00
Michael Schurter
8c35388677 Skip setting MemorySwap on Windows
Windows doesn't support this Docker setting.

Fixes #2193
2017-02-21 13:21:42 -08:00
Alex Dadgar
4ba4987625 Drivers log during fingerprinting
This PR fixes a regression in which some drivers did not log during
fingerprinting.
2017-02-20 19:35:51 -08:00
Diptanu Choudhury
b52aa931a3 Merge pull request #2222 from hashicorp/b-docker-image-not-found
Making the docker driver retry when an image is not found
2017-01-23 14:58:00 -08:00
Diptanu Choudhury
5992a2a88a Added a comment 2017-01-23 14:57:30 -08:00
Alex Dadgar
77b19f55a0 Add test and better logs
This commit adds a test to retrieving auth configurations, use either
the auth block in the config or specified via the agent config and adds
a log if lookup fails.
2017-01-23 14:48:02 -08:00
Alex Dadgar
67bec60f1b Close file 2017-01-23 11:37:45 -08:00
Alex Dadgar
abd06938e5 Deprecation notice 2017-01-23 11:32:51 -08:00
Alex Dadgar
3c610ec864 Remove SSL 2017-01-23 11:32:51 -08:00