Commit Graph

411 Commits

Author SHA1 Message Date
Chris Bednarski 65d4aa889b Enable raw exec in dev mode 2015-12-10 14:48:06 -08:00
Alex Dadgar 5eeec26102 Do Once docker client initialization 2015-12-10 13:49:29 -08:00
Diptanu Choudhury de06482506 Sending the user process sigint during shutdown on linux 2015-12-08 08:14:13 -08:00
Chris Bednarski 9292a97062 Merge branch 'user-lookup-nocgo' of https://github.com/carlosdp/nomad into b-user-lookup 2015-12-01 13:44:56 -08:00
Carlos Diaz-Padron 55e49506f0 Refactor out userLookup to helper package
Also replaces user.Lookup in exec driver
2015-12-01 11:59:55 -08:00
Diptanu Choudhury 29915ddd16 Moving the args to helper 2015-11-26 14:13:19 -08:00
Chris Hines 37745f66c9 Speed up tests by allowing parallel execution. 2015-11-25 15:56:55 -05:00
Chris Hines 5b2168bb12 Use package testtask and httptest.Server to make client/driver tests OS independent. 2015-11-25 15:56:20 -05:00
Chris Hines e569fb4787 Use package testtask in client/driver/spawn tests. 2015-11-25 15:34:55 -05:00
Chris Hines 46e848c8ec Eliminate special case in production code for embedding test binary into chroot. 2015-11-25 15:31:29 -05:00
Chris Hines d7ebe099c1 Factor portable test task out of client/driver/executor. 2015-11-24 20:59:42 -05:00
Alex Dadgar c7cd7abe22 Inject the current binary into the chroot in test mode 2015-11-24 16:30:53 -08:00
Chris Hines ea5a60629a Fix Executor_Open_Invalid test for Windows. 2015-11-24 16:30:53 -08:00
Chris Hines cb262d787f Include Executor_Open_Invalid in test suite. 2015-11-24 16:30:53 -08:00
Chris Hines 769415dbd2 Improve names and documentation in test code. 2015-11-24 16:30:53 -08:00
Chris Hines ec7e78680d Use TestMain to provide portable echo, sleep, and write commands. 2015-11-24 16:30:53 -08:00
Alex Dadgar b2daa5e2e6 Standardize log messages in fingerprinters to DEBUG 2015-11-24 11:06:51 -08:00
Chris Bednarski 3ed8cb5b8b Merge pull request #481 from hashicorp/b-vet
Fix some issues caught by go vet
2015-11-20 16:31:47 -08:00
Chris Bednarski e6daf57b10 Merge pull request #480 from hashicorp/f-docker-tls-config
Added docker.tls config file options and docs
2015-11-20 16:31:41 -08:00
Chris Bednarski 655a4bf334 Fix some issues caught by go vet 2015-11-20 16:01:27 -08:00
Chris Bednarski 719c345164 Change println to printf 2015-11-20 16:00:58 -08:00
Chris Bednarski 8169c8e185 Don't show endpoint when we're not using it 2015-11-20 15:53:38 -08:00
Chris Bednarski 4063b6583e Added docker.tls config file options and docs 2015-11-20 15:47:03 -08:00
Alex Dadgar 34b2f62c0b Merge pull request #442 from ChrisHines/windows-spawn
Fix tests for nomad/client/driver/spawn package to work on Windows.
2015-11-20 14:49:54 -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
Chris Bednarski 6253b1d0aa Add ContainerID() method to get the containerID from a handle 2015-11-19 13:57:18 -08:00
Antonio Fernández 581245f881 fix docker port allocation? 2015-11-19 19:15:25 +01:00
Chris Hines 3a77952d59 Handle additional edge cases when parsing environment variables. 2015-11-18 21:21:07 -05: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 6574fd27e3 Remove returning the error 2015-11-18 12:40:34 -08:00
Alex Dadgar 5a678548fa Rebase 2015-11-18 12:30:35 -08:00
Alex Dadgar c04e2b8b8e Fix executor tests 2015-11-18 12:29:04 -08:00
Alex Dadgar 54ddf4d3c1 Rebase 2015-11-18 12:29:04 -08:00
Alex Dadgar 7b918ee1e7 Update ParseAndReplace to take a list of args and remove shell style parsing 2015-11-18 12:29:04 -08:00
Chris Hines 713d63e467 Move test code to *_test.go file. 2015-11-18 14:46:56 -05:00
Chris Bednarski fc69721cc7 Added missing %s to error format string 2015-11-18 11:29:49 -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 b9fcdc400a Merge branch 'master' into f-docker-dns-config 2015-11-18 10:31:06 -08:00
Carlos Diaz-Padron 4a6c3d773d Nest Docker driver auth under object 2015-11-18 01:37:42 -08:00
Carlos Diaz-Padron de6c06d332 De-nest docker registry auth and reformat related doc 2015-11-17 23:32:57 -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 6c1df52342 Merge pull request #439 from hashicorp/b-docker-ports-len
Fix docker port tests and empty port_map
2015-11-17 21:37:48 -08:00
Chris Bednarski c851ae67c7 Change error check to contains instead of == 2015-11-17 21:36:23 -08:00
Chris Bednarski 563e1aff56 Renamed some things so it's more apparent that reserved and dynamic port mapping have very similar code 2015-11-17 21:34:07 -08:00
Chris Bednarski 8705ea07a4 Remove \n since this is added by the logger 2015-11-17 21:17:51 -08:00
Alex Dadgar 2a8bd98fdc Qemu driver takes a port_map to configure host to guest port forwarding 2015-11-17 20:54:53 -08:00
Chris Bednarski 5ac6664c46 Purge existing container during Start() 2015-11-17 20:50:14 -08:00
Chris Hines af2c47460b Speed up tests by allowing parallel execution. 2015-11-17 23:43:20 -05:00
Chris Hines 2120e9e10a Move defer f.Close after error check. 2015-11-17 23:43:20 -05:00
Chris Hines 8e8eccee20 Use TestMain to provide portable echo and sleep commands. 2015-11-17 23:43:19 -05:00
Chris Hines 071018569d Extract code to acquire temp file name and make sure the file is closed so os.Remove works on Windows. 2015-11-17 23:43:18 -05:00
Chris Bednarski 0e1fe2373a Log container name and labels 2015-11-17 20:04:10 -08:00
Chris Bednarski 640af994ca Added a randomized alloc id for tests so container names don't collide 2015-11-17 19:45:33 -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
Alex Dadgar 45bb0d349c Update API docs 2015-11-17 19:12:19 -08:00
Chris Bednarski d098acef90 Fix guard for port maps not being specified 2015-11-17 18:16:01 -08:00
Chris Bednarski 122220a424 Merge branch 'master' into f-docker-any-network 2015-11-17 17:22:13 -08:00
Chris Bednarski 9cad290b18 Merge pull request #436 from hashicorp/f-docker-cleanup
Cleanup docker driver
2015-11-17 17:13:17 -08:00
Chris Bednarski b22b5eb3aa Inline err assignment 2015-11-17 17:12:45 -08:00
Chris Bednarski a2f4188246 Streamline reading boolean values from the driver / job config 2015-11-17 16:58:23 -08:00
Chris Bednarski 67ee502acb Added missing linebreaks for log.Printf calls 2015-11-17 16:49:01 -08:00
Chris Bednarski 43aaf94383 Do Itoa once so line items are simpler 2015-11-17 16:31:47 -08:00
Chris Bednarski ffd3f114dd Merge branch 'docker-allow-to-add-labels' of https://github.com/fernandezvara/nomad into f-docker-labels 2015-11-17 16:02:42 -08:00
Chris Bednarski 3b7c252090 Improve phrasing in log messages 2015-11-17 15:17:44 -08:00
Alex Dadgar 7551a263c5 Merge pull request #389 from achanda/name
Set a name for the container
2015-11-17 15:07:23 -08:00
Chris Bednarski 629cdd6baa Clean up extraneous variables 2015-11-17 14:51:38 -08:00
Chris Bednarski 7f117b3b55 That's not a declaration 2015-11-17 14:27:58 -08:00
Chris Bednarski 89c6f56059 Remove restrictions from docker networking mode; we assume users know what they are doing 2015-11-17 14:25:10 -08:00
Chris Bednarski f2e8357e4a Merge branch 'master' into f-docker-cleanup 2015-11-17 14:20:29 -08:00
Antonio Fernández f7f83ee81c allow to set labels on docker containers 2015-11-17 14:12:49 +01:00
Carlos Diaz-Padron 77923255b4 Add hostname parameter to Docker driver 2015-11-16 22:44:44 -08:00
Chris Bednarski bac9bd60dc Improve logging and DRY some of the port mapping code 2015-11-16 19:55:49 -08:00
Diptanu Choudhury 03847dd65a Addressed some review comments 2015-11-16 22:29:06 -05:00
Chris Bednarski d00c700318 go fmt 2015-11-16 16:23:03 -08:00
Chris Bednarski 714e1b52d1 Change logging port as %d to logging port.Value 2015-11-16 16:05:28 -08: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 c5102975e3 Made the code more DRY 2015-11-16 13:10:57 -08:00
Diptanu Choudhury e40229aed6 Fixed the docker auth config 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 7d44725370 Adding comments to fields in the docker driver config 2015-11-16 13:10:57 -08:00
Alex Dadgar fa60d86fe5 mapstructure close quotes 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 5e876e9c86 Fixed the java driver config 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 9d76572831 Making sure that there is only one port_map block in the docker driver config 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 3b3907e367 Fixed the exec driver config 2015-11-16 13:10:57 -08:00
Diptanu Choudhury ba9f101660 Fixed the test related to setting env variables in tasks 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 0673b832fb Fixed compilation issues with driver tests 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 78a0f82bc5 Making the config for drivers public 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 4e05b27111 Implemented port labeling and driver configs 2015-11-16 13:10:57 -08:00
Chris Bednarski ef00ab3198 Change this to a valid IP address so docker can bind to it 2015-11-12 21:46:59 -08:00
Chris Bednarski 2f05a15aa5 Expose mapped ports 2015-11-12 17:23:04 -08:00
Alex Dadgar d3e2455459 Merge pull request #408 from hashicorp/f-client-restore
Client Restore State Fixes
2015-11-11 12:32:11 -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
Alex Dadgar 787164044d Enable Open tests for Exec/Java 2015-11-10 16:59:52 -08:00
Alex Dadgar 90336a160e Guard mounting dev/ and proc/ and TaskRunner_RestoreState test 2015-11-10 16:35:33 -08:00
Chris Bednarski 7f3a2595af Change Docker fingerprinter to INFO and not error when the connection to the daemon fails; we simply assume docker isn't there. 2015-11-10 16:18:52 -08:00
Alex Dadgar 933498e388 Client Restore test 2015-11-10 16:03:18 -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 d56f9715c9 Comments on alive 2015-11-06 11:26:14 -08:00
Alex Dadgar 2321bddf2e Add Valid command to spawner and make executors check when opening 2015-11-06 11:23:27 -08:00
Alex Dadgar f36685c7d2 Merge pull request #392 from hashicorp/f-raw-exec-use-exec
RawExec driver uses exec_basic
2015-11-06 10:48:55 -08:00
Alex Dadgar 71be38abe0 merge 2015-11-06 10:42:49 -08:00
Alex Dadgar a5940ef25e Merge 2015-11-06 10:41:42 -08:00
Alex Dadgar bb9f2aa66c Docker privileged checks if host enabled it 2015-11-06 10:38:54 -08:00
Alex Dadgar 149366b89e Merge pull request #390 from the-control-group/f-docker-driver-options
Expanded docker driver options
2015-11-06 10:32:54 -08:00
Abhishek Chanda 94a4d00f4b Set a name for the container. 2015-11-06 03:33:57 +00:00
Alex Dadgar 135d8630f6 Merge pull request #391 from hashicorp/f-periodic-fingerprint
Add support for periodic fingerprints and make consul periodic
2015-11-05 18:49:42 -08:00
Diptanu Choudhury b035661d7d Passing in the AllocID to exec context so that it can be used in the drivers 2015-11-05 18:34:04 -08:00
Shiem Edelbrock 5e2430de74 Fix build
returned wrong value, and forot a ":" :/
2015-11-05 17:57:51 -08:00
Shiem Edelbrock 1169bef912 Updated `priviliged` option, added client `priviliged` option
- Added error checking on priviliged mode.
- Added `docker.privileged.enabled` to client config/fingerprint
2015-11-05 16:40:20 -08:00
Alex Dadgar 880d567836 Merge pull request #388 from hashicorp/f-basic-exec-use-spawner
Basic executor uses spawner and an executor test harness
2015-11-05 13:57:11 -08:00
Alex Dadgar f9fd83c696 Merge fix 2015-11-05 13:46:02 -08:00
Alex Dadgar d14bc26607 Calling incorrect executor build method 2015-11-05 11:54:51 -08:00
Clint e494a24335 Merge pull request #381 from hashicorp/f-getter-refactor
client/drivers: Refactor to use Getter wrapper
2015-11-05 13:47:42 -06:00
Alex Dadgar 04aecbda0b Fix typo 2015-11-05 11:31:50 -08:00
Alex Dadgar 3cf7dfb588 Merge pull request #377 from nak3/selinux-docker-driver
Apply SELinux label to allocate directory of docker driver
2015-11-05 10:54:48 -08:00
Shiem Edelbrock adb8d4c1f7 Merge branch 'master' of https://github.com/hashicorp/nomad into f-docker-driver-options
* 'master' of https://github.com/hashicorp/nomad: (59 commits)
  Move the executor and spawn package into driver
  Remove file watching
  Check if the PID is alive instead of heartbeating through modify time
  Update CHANGELOG.md
  nomad/watch: add a note about the Item struct
  go fmt this file
  Vet errors
  Search path
  Update website
  Make a basic executor that can be shared and fix some fingerprinting/tests
  Small improvements
  Use const value for AWS metadata URL
  Create Spawn pkg that handles IPC with the spawn-daemon and update exec_linux to use that
  Fixed the restart policy syntax
  Introducing vars to create default batch and service restart policies
  Fixed the tests
  Declaring Batch and Service default restart policies
  Fixing tests to not create a TG without restart policies
  This option only work -> This option only works
  leave -> leaving
  ...
2015-11-05 10:48:09 -08:00
Shiem Edelbrock c174f4819b Added task configuraton options for docker driver
- Added `priviliged` option to task config to allow containers to run in
 priviliged mode.
- Added `dns-servers` option to task config to allow containers to use
  custom DNS servers
- Added `search-domains` option to task config to allow containers to
  use custom dns search domains
- Added authentication options (under key namespace `auth.*`) to allow
  authentication on a task level for docker remote.
- Updated site docs to reflect changes
2015-11-05 10:47:41 -08:00
Alex Dadgar 3cc2dd52b6 exec_basic uses Spawner; create shared test harness for executors 2015-11-05 09:58:57 -08:00
Clint Shryock fb8066d8f3 add checksums to tests, formatting after rebase 2015-11-05 09:23:45 -06:00
Clint Shryock 1a35649ea1 remove debug line 2015-11-05 08:55:30 -06:00
Clint Shryock 145a2e3610 refactor drivers to use new getter 2015-11-05 08:55:30 -06:00
Alex Dadgar 587031f14d Get rid of exec.cmd struct and setuid file 2015-11-04 17:20:52 -08:00
Alex Dadgar 4259d3a43c Move the executor and spawn package into driver 2015-11-04 16:53:27 -08:00
Alex Dadgar f210fcd1a6 Merge pull request #380 from hashicorp/f-daemonize
Improve spawn-daemon and Nomad Client usage of it
2015-11-04 16:44:50 -08:00
Kenjiro Nakayama 1e47dd4c7d Apply SELinux label to allocate directory of docker driver 2015-11-05 09:06:22 +09:00
Alex Dadgar d83777f198 Make a basic executor that can be shared and fix some fingerprinting/tests 2015-11-03 12:47:48 -08:00
Alex Dadgar 271702f4a2 Small improvements 2015-11-03 10:50:30 -08:00
Alex Dadgar 5562fc7672 Create Spawn pkg that handles IPC with the spawn-daemon and update exec_linux to use that 2015-11-02 20:28:37 -08:00
Alex Dadgar 01e0be4cc6 Add comment explaining the qemu-img command on windows 2015-10-29 16:57:02 -07:00
Alex Dadgar 2781cbbde1 Exec driver only applies on linux as root 2015-10-28 17:22:04 -07:00
Alex Dadgar a5a1e45f4b Get Qemu to fingerprint and test properly on both windows and linux 2015-10-27 15:27:11 -07:00
Clint 4b0dc2cb39 Merge pull request #288 from hashicorp/f-go-getter
Drivers: Use go-getter for artifact retrieval, add artifact support to Exec, Raw Exec drivers
2015-10-26 10:00:29 -05:00
Clint Shryock 343daeb1ea drivers: Add/Use go-getter to fetch remote binaries
Updates Qemu, Java drivers to use go-getter to fetch binaries
Adds remote artifact support for Exec, Raw Exec drivers
2015-10-26 09:40:06 -05:00
Alex Dadgar b5caa6c5bd Merge branch 'master' of https://github.com/hashicorp/nomad 2015-10-23 16:23:54 -07:00
Alex Dadgar d2b23c9143 Format rkt_test 2015-10-23 16:23:43 -07:00
Abhishek Chanda 6ecab13b5d Cleanup tests
- Consolidate checking if non-windows and if qemu is installed
- Fix non-windows check
2015-10-23 14:19:22 -07:00
Abhishek Chanda 81da6ce54e Just put the version as string 2015-10-21 21:09:04 -07:00
Alex Dadgar fd77180d64 Merge pull request #291 from hashicorp/d-rkt-volume-mounts-blocked
Document that Rkt doesn't support task directory mounting
2015-10-16 17:07:53 -07:00
Abhishek Chanda 9e541450c2 Actually append jvm opts to the CLI
- Also adds a test
2015-10-16 22:45:16 +00:00
Abhishek Chanda dfbdb10fcb No need to pass jvm_options initially 2015-10-16 12:44:43 -07:00
Abhishek Chanda ab1a8f3532 Some minor style cleanups 2015-10-16 12:44:33 -07:00
Abhishek Chanda 6ab97078e5 Support passing options to the JVM in java driver
Closes #292
2015-10-16 12:44:33 -07:00