Commit Graph

42 Commits

Author SHA1 Message Date
Chelsea Komlo
7b9cf12244 Merge pull request #3781 from hashicorp/f-client-fingerprint-refactor
Refactor client fingerprinters to return a diff of node attributes
2018-02-01 20:13:44 -05:00
Chelsea Holland Komlo
ba2ebbc7f9 code review fixup 2018-01-31 18:34:03 -05:00
Chelsea Holland Komlo
a9447addd3 add applicable boolean to fingerprint response
public fields and remove getter functions
2018-01-31 13:21:45 -05:00
Michael Schurter
d50ae8a92b Merge pull request #3773 from mikemccracken/2018-01-18/destroy-container-on-err
lxc: cleanup partially configured containers after errors in Start
2018-01-30 14:52:29 -08:00
Chelsea Holland Komlo
f5fc20a564 create safe getters and setters for fingerprint response 2018-01-26 11:22:05 -05:00
Michael McCracken
2e72eea00a lxc: move lxc log file out of container-visible alloc dir
The LXC runtime's log file is currently written to TaskDir.LogDir,
which is mounted as alloc/logs inside the containers in the task
group.

This file is not intended to be visible to containers, and depending
on the log level, may have information about the host that a container
should not be allowed to see.

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
2018-01-25 14:41:37 -08:00
Michael McCracken
2dd31f2cc7 fix speling in log
Signed-off-by: Michael McCracken <mikmccra@cisco.com>
2018-01-25 13:56:14 -08:00
Chelsea Holland Komlo
5e8151d700 refactor Fingerprint to request/response construct 2018-01-24 11:54:02 -05:00
Michael McCracken
81f64eea27 review cleanup
don't export an internal function, and simplify some code

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
2018-01-23 15:03:09 -08:00
Michael McCracken
0e9bae7bb4 lxc: cleanup partially configured containers after errors in Start
If there are any errors in container setup after c.Create() in
Start(), the container will be left around, with no way to clean it up
because the handle will not be created or returned from Start.

Added a wrapper that checks for errors and performs appropriate
cleanup. Returning a cleanup function from a wrapped function instead
of just doing the cleanup before returning the error helps to ensure
that future changes that might add or change error exits can't forget
to consider a cleanup function.

Adds a check to the invalid config test case to check that a container
created with an invalid config doesn't get left behind.

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
2018-01-18 16:03:03 -08:00
Michael McCracken
bbdd58963d lxc: Add config flag to disable volume support
Signed-off-by: Michael McCracken <mikmccra@cisco.com>
2018-01-18 04:17:42 -08:00
Michael McCracken
b597916a95 Add volumes config to LXC driver
Allow lxc driver to accept bind mount config similarly to the docker
driver.

Includes some static sanity checks in Validate step

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
2018-01-18 04:17:42 -08:00
Alex Dadgar
a9e3a41407 Enable more linters 2017-09-26 15:26:33 -07:00
Alex Dadgar
5d4b0ab016 typo 2017-07-22 12:55:30 -07:00
Alex Dadgar
f30e5a5984 typo 2017-07-22 12:33:07 -07:00
Alex Dadgar
3cb16aa9a8 small fixes 2017-07-22 12:25:02 -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
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
0e0845e94b Use a DriverAbility to expose Exec functionality 2017-04-19 12:42:47 -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
db096b23b5 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
1ec5c930a6 Return errors from cleanup and let TaskRunner retry 2017-01-12 17:21:54 -08:00
Michael Schurter
33c015bcc7 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
Michael Schurter
de7351b959 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
fccf115c56 Merge pull request #2054 from hashicorp/f-prestart
Add Driver.Prestart method
2016-12-20 16:18:56 -08:00
Michael Schurter
630812bbdd lxc: Set image local env vars 2016-12-20 14:37:18 -08:00
Alex Dadgar
92dc04e335 Fix mapstructure tag formatting for lxc driver 2016-12-16 10:24:17 -08:00
Michael Schurter
ee17940dfe 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
Ranjib Dey
1aaceafecc Fix error message. Pass on template args 2016-11-21 20:12:59 -08:00
Michael Schurter
ba0983c35a Add LXC docs and enable by default for lxc builds 2016-11-01 10:18:16 -07:00
Michael Schurter
aeb410c07c Put lxc support behind a flag
Since lxc support requires linking to a C lib at compile and runtime
I'm putting it behind a build flag to avoid forcing all nomad users to
install liblxc (lxc-dev for development).
2016-10-26 14:55:54 -07:00
Michael Schurter
7eae82191e Fix LXC driver interface impls 2016-10-26 10:06:03 -07:00
Diptanu Choudhury
b0c665ce26 Added lxc related dependencies 2016-10-25 15:17:02 -07:00
Michael Schurter
317922642f Fix comment form 2016-10-21 16:56:33 -07:00
Michael Schurter
1566b979e3 Disable lxc by default 2016-10-13 13:22:12 -07:00
Michael Schurter
af8a20bc7d Cleanup comments/whitespace 2016-10-13 13:05:55 -07:00
Michael Schurter
487a4980e0 Mount secret dir 2016-10-13 12:45:33 -07:00
Diptanu Choudhury
14294fde77 throwing an error if stats line can't be converted to k/v pair 2016-10-12 17:18:58 -07:00
Diptanu Choudhury
d4fba69b95 Bind mounting alloc dir into container 2016-10-12 17:18:58 -07:00
Diptanu Choudhury
9ae6c0e8d4 Setting the network type 2016-10-12 17:18:58 -07:00
Diptanu Choudhury
340efc879d Adding cpu resource limits 2016-10-12 17:18:58 -07:00
Diptanu Choudhury
7300ea8463 Implemented an LXC Driver 2016-10-12 17:18:58 -07:00