Commit Graph

163 Commits

Author SHA1 Message Date
Alex Dadgar aa05ecc37c Merge pull request #2361 from hashicorp/f-docker-coordination
Docker Image Coordinator and caching
2017-02-24 14:18:21 -08:00
Alex Dadgar b5d4f39734 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 f61b7975a3 Put access to Docker volume drivers behind flag 2017-02-23 15:47:36 -08:00
Alex Dadgar c62cd5cc55 Revendor docker client 2017-02-14 17:34:05 -08:00
Alex Dadgar e160b2b38f 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
Michael Schurter 82b49d4547 Updated CreatedResources as images are cleaned 2017-01-17 16:13:40 -08:00
Michael Schurter a3a3656dbb Switch to use recoverable errors from Cleanup
TaskRunner handles retrying but Cleanup handles all of CreatedResources.
2017-01-13 16:46:08 -08:00
Michael Schurter dc68aa1a5a Return errors from cleanup and let TaskRunner retry 2017-01-12 17:21:54 -08:00
Michael Schurter 4d081490e6 Add Cleanup method to Driver interface
Cleanup can be used for cleaning up resources created by drivers to run
a task. Initially the Docker driver is the only user (to remove
downloaded images).
2017-01-11 17:23:33 -08:00
Cameron Davison c910f9b304
using new ctx instead of getting both params back 2017-01-10 16:54:01 -06:00
Cameron Davison 88a462d5b9
add force_pull to docker driver 2017-01-10 16:54:01 -06:00
Michael Schurter e203928d64 Driver is now required in test tasks 2017-01-06 11:39:17 -08:00
Michael Schurter 86fcf96f72 Put a logger in AllocDir/TaskDir 2017-01-05 16:31:56 -08:00
Michael Schurter 7260d0bca3 Test tasks now require driver name 2017-01-05 16:31:55 -08:00
Michael Schurter 3ea09ba16a Move chroot building into TaskRunner
* Refactor AllocDir to have a TaskDir struct per task.
* Drivers expose filesystem isolation preference
* Fix lxc mounting of `secrets/`
2017-01-05 16:31:49 -08:00
Michael Schurter 4a9a574d9d Merge pull request #2054 from hashicorp/f-prestart
Add Driver.Prestart method
2016-12-20 16:18:56 -08:00
Michael Schurter 39f587a2af Fix tests broken by TaskEnv change 2016-12-20 14:37:35 -08:00
Michael Schurter 770ed703d0 Add Driver.Prestart method
The Driver.Prestart method currently does very little but lays the
foundation for where lifecycle plugins can interleave execution _after_
task environment setup but _before_ the task starts.

Currently Prestart does two things:

* Any driver specific task environment building
* Download Docker images

This change also attaches a TaskEvent emitter to Drivers, so they can
emit events during task initialization.
2016-12-02 11:03:48 -08:00
Dmitry Galinsky 3ec7ebac9c Add network_aliases for docker driver 2016-11-16 11:16:07 +03:00
Alex Dadgar a11d66f639 Remove todo 2016-11-10 15:20:19 -08:00
Alex Dadgar eea35626b7 Changes the relative path from joining against the alloc dir to the
task's directory.

This PR changes the behavior when given a relative host path when
mounting docker containers. Prior to this, the behavior was to mount by
joining against the alloc/ directory. This PR changes it to be against
the task/ directory.
2016-11-10 14:47:54 -08:00
Alex Dadgar 62f1b98954 Add docker test 2016-10-28 17:53:25 -07:00
Alex Dadgar 5ddf646615 Don't delete docker images in test 2016-10-27 12:31:53 -07:00
Michael Schurter d3835283ca Expand env vars in docker volume paths
Fixes #1876
2016-10-27 11:02:38 -07:00
Michael Schurter 5d358c7eba Allow mounting alloc-dir-relative paths in docker 2016-10-25 09:46:49 -07:00
Michael Schurter 49ed6da0ad Enable rkt and docker volume mounting by default 2016-10-25 09:46:49 -07:00
Alex Dadgar 5577e53b20 Merge pull request #1845 from hashicorp/f-remove-disk-usage-acct
Remove disk usage enforcement
2016-10-22 19:01:51 -07:00
Alex Dadgar e85a67a49a Fix signal test for docker 2016-10-22 18:32:48 -07:00
Michael Schurter 285e80ac0f Remove disk usage enforcement
Many thanks to @iverberk for the original PR (#1609), but we ended up
not wanting to ship this implementation with 0.5.

We'll come back to it after 0.5 and hopefully find a way to leverage
filesystem accounting and quotas, so we can skip the expensive polling.
2016-10-21 13:55:51 -07:00
Alex Dadgar 280af8f4d1 Docker + Qemu 2016-10-10 11:47:04 -07:00
Michael Schurter 44219cc083 Put docker volume support behind conf flag
Also add tests and fix bug with logging driver configuration.
2016-10-03 15:02:50 -07:00
Alex Dadgar eef786dd9d Secret dir materialized in alloc/task directory 2016-09-02 12:44:05 -07:00
Alex Dadgar 0f3ec9c759 Fix TestDockerDriver_Fingerprint 2016-08-23 10:39:40 -07:00
Diptanu Choudhury dc0e395982 re-using copyimage 2016-08-17 15:25:03 -07:00
Diptanu Choudhury 0d7cd53c63 Fixed docker tests 2016-08-17 15:25:03 -07:00
Diptanu Choudhury f3420c65e3 Updated the busybox images 2016-08-12 11:39:58 -07:00
Alex Dadgar b34d65f1a5 Update test.sh 2016-08-11 21:35:50 -07:00
Diptanu Choudhury 839ecd1df6 Fixed docker tests 2016-08-11 19:28:41 -07:00
Diptanu Choudhury b71f687f62 Merge pull request #1413 from hashicorp/b-tests
Fix flaky tests
2016-08-11 18:15:29 -07:00
Mathias Lafeldt 0727db4ca0
Test configuration of Docker working directory 2016-08-03 16:35:49 +02:00
Alex Dadgar 807bf3cf6c tests wait for the container to start 2016-07-12 11:36:06 -06:00
Alex Dadgar e1d68f3e9b Docker host network test 2016-07-12 10:59:34 -06:00
Diptanu Choudhury 5d61fa01f1 Fixed tests 2016-07-08 18:27:51 -07:00
Alex Dadgar e931b42473 unify cli output 2016-06-12 13:16:07 -07:00
Alex Dadgar 6ef4bfd6bf skip docker test if no docker found 2016-06-12 11:28:43 -07:00
Diptanu Choudhury f95b1d00c3 Renamed error message in alloc endpoint 2016-05-28 20:03:52 -07:00
Diptanu Choudhury 11d1dd113b Added a test for docker 2016-05-28 19:59:20 -07:00
Diptanu Choudhury 76509eb230 Fixed docker test 2016-05-22 02:49:33 -07:00
Sean Chittenden 93bcc30a9c Revert making UniversalExecutor.wait() platform specific 2016-05-08 11:21:34 -07:00
Sean Chittenden f2b6303d49 Catch up with error message drift in docker 2016-05-07 15:46:44 -07:00
Diptanu Choudhury 081852d3cd Modified the test to wait for 3 seconds before inspecting containers 2016-04-14 06:43:37 +05:30
Diptanu Choudhury e599ab795c Added a test to ensure that the docker driver is removing containers after container exits successfully 2016-04-12 01:00:14 -04:00
Diptanu Choudhury 2601468708 Making the load a list of strings and added website docs 2016-03-30 17:23:29 -07:00
Diptanu Choudhury cc9c07afdb Added a test 2016-03-30 13:42:17 -07:00
Diptanu Choudhury e893e71e21 Moved the dockerIsConnected to testutils 2016-03-25 17:15:51 -07:00
Miquel Sabaté Solà 8c56c64615 client/driver: added the `user` config value
This way Nomad allows to set which user has to run the task.

Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
2016-03-23 12:57:31 +01:00
Diptanu Choudhury 3c7b83b393 Introduced a method in executor to launch syslog server 2016-03-18 11:49:10 -07:00
Alex Dadgar 3dfe8e70f6 Fix test 2016-03-08 11:41:26 -08:00
Diptanu Choudhury ce5b497dbc Adding version to the DockerHandle test 2016-02-25 08:51:10 -08:00
Diptanu Choudhury ab75f89c33 Fixed docker tests 2016-02-10 13:29:06 -08:00
Diptanu Choudhury 79141f3021 Fixed the docker handle id test 2016-02-10 13:18:10 -08:00
Ivo Verberk 061445468b Rename IPPort env variable and add a mapped host port to the env. 2016-01-25 20:46:01 +01:00
Ivo Verberk e58bda9056 Pass a combination of ip and port to the task environment.
The different labels can be on different IPs.
2016-01-24 10:31:03 +01:00
Alex Dadgar a3c22258cd Use TestMultiplier on all waits 2016-01-21 15:24:24 -08:00
Alex Dadgar 1ceb6f012a Fix a bunch of tests
Up timeouts

trusty travis beta

Increase timeouts
2016-01-20 16:03:53 -08:00
Alex Dadgar 9f5ccee7ff Fix docker tests 2016-01-19 15:35:01 -08:00
Alex Dadgar 6d157a0337 Fix tests 2016-01-11 09:58:31 -08:00
Alex Dadgar ddf392c6be User specifiable kill timeout and operator configurable max 2015-12-22 16:10:30 -08:00
Chris Hines 37745f66c9 Speed up tests by allowing parallel execution. 2015-11-25 15:56:55 -05:00
Chris Bednarski 655a4bf334 Fix some issues caught by go vet 2015-11-20 16:01:27 -08:00
Chris Bednarski 10bb550ad8 Added client checks back to the tests that can't use dockerSetup() 2015-11-20 13:50:47 -08:00
Chris Bednarski cf4bb4cfd0 Squash []map[string]type for port_map and labels into map[string]type 2015-11-19 21:29:37 -08:00
Chris Bednarski 275550dcd3 Fixed some issues with expose, port mapping, and environment variables
- Port mapping now works for reserved ports as well as dynamic ports
- Environment variables were being set twice in two different ways; now they are only set once
- Comprehensive tests for exposed ports, forwarded ports, and environment variables
- Cleaned up / DRYed up a lot of test code
2015-11-19 19:08:21 -08:00
Chris Bednarski b9b786732e Export DockerHandle and change tests to use DockerHandle.ContainerID() 2015-11-19 14:20:41 -08:00
Alex Dadgar 4d817f5cbc Revert "Revert "Make drivers take arguments as a list and not as a string"" 2015-11-18 15:16:42 -08:00
Alex Dadgar 0e51375285 Revert "Make drivers take arguments as a list and not as a string" 2015-11-18 13:46:43 -08:00
Alex Dadgar 5a678548fa Rebase 2015-11-18 12:30:35 -08:00
Alex Dadgar 54ddf4d3c1 Rebase 2015-11-18 12:29:04 -08:00
Chris Bednarski e17f5984ef Revert "Added missing %s to error format string"
This reverts commit f4acdfd035c2ffa196035cc574d8b40a1795abb3.
2015-11-18 11:28:38 -08:00
Chris Bednarski 7a077a29b5 Added missing %s to error format string 2015-11-18 11:28:07 -08:00
Chris Bednarski f4344092fb Change DNS and DNSSearch to use lists; added a test 2015-11-17 22:02:23 -08:00
Chris Bednarski c80cf651e8 Merge branch 'master' into f-docker-dns-config 2015-11-17 21:43:04 -08:00
Chris Bednarski 7b25c9b4d9 Change dns_servers and dns_search_domains from comma-delimited strings to lists 2015-11-17 21:41:00 -08:00
Chris Bednarski 9a7adb9eb3 Fix guards for docker port mapping and change dummy dynamic ports to real ports (0 is not a valid port) 2015-11-17 19:21:36 -08:00
Antonio Fernández f7f83ee81c allow to set labels on docker containers 2015-11-17 14:12:49 +01:00
Chris Bednarski 9f40143684 Merge branch 'master' into f-port-labels 2015-11-16 16:02:38 -08:00
Alex Dadgar 82f51601db Track Task State in the client and capture Wait results 2015-11-16 15:14:21 -08:00
Diptanu Choudhury 0673b832fb Fixed compilation issues with driver tests 2015-11-16 13:10:57 -08:00
Chris Bednarski b637ca7f60 Added some comments to the test to explain why we're doing stuff this way 2015-11-10 17:48:06 -08:00
Chris Bednarski c5682fc751 Change dockerIs* to accept *testing.T for logging 2015-11-10 17:43:08 -08:00
Chris Bednarski e5688620e4 Changed behavior for Docker ENV
- Docker ENV variables now work the same way in production, dev, and test
- Docker ENV variables are *ignored* if docker.endpoint is present in the Nomad config file
- Remote tests now work correctly
2015-11-10 15:54:31 -08:00
Alex Dadgar 2f6a279d09 Docker alloc dir tests and test fixes 2015-10-15 16:59:08 -07:00
Alex Dadgar a4035050e8 Change Docker/Rkt to set driver to 1 not true for consistency 2015-10-12 13:15:37 -07:00
Chris Bednarski a4c3da6c0c Merge branch 'master' into b-docker-port 2015-10-06 17:54:32 -07:00
Chris Bednarski d046858057 Support boot2docker or VM for dev/test 2015-10-06 17:53:05 -07:00
Chris Bednarski 88bb01ab6f Fingerprint test should now behave correctly when the executor is not installed; fix some go vet issues 2015-10-06 16:33:02 -07:00
Chris Bednarski 42afc2bfeb This is needed for 1.4.2 compat; not sure what removed it 2015-10-06 00:32:34 -07:00
Chris Bednarski 58217619e3 Add skip detection for all docker tests 2015-10-06 00:27:05 -07:00
Alex Dadgar faf8002d2d go-fmt 2015-10-02 10:54:04 -07:00
Abhishek Chanda 0cb649bd5f Enable setting networking mode for docker
This patch enables setting networking mode for the docker
driver. This does not handle the `container` mode.
Closes #175
2015-10-01 18:52:41 -07:00