Commit Graph

96 Commits

Author SHA1 Message Date
Michael Schurter
b584fbd001 Make sure unmounting the secrets dir is idemptoent 2017-03-01 17:19:39 -08:00
Michael Schurter
da3e34710c Fix allocdir Move test and make code more defensive
A change in the behavior of `os.Rename` in Go 1.8 brought to light a
difference in the logic between `{Alloc,Task}Runner` and this test:

AllocRunner builds the alloc dir, moves dirs if necessary, and then lets
TaskRunner call TaskDir.Build().

This test called `TaskDir.Build` *before* `AllocDir.Move`, so in Go 1.8
it failed to `os.Rename over` the empty {data,local} dirs.

I updated the test to behave like the real code, but I defensively added
`os.Remove` calls as a subtle change in call order shouldn't break this
code. `os.Remove` won't remove a non-empty directory, so it's still
safe.
2017-02-21 17:22:10 -08:00
Michael Schurter
b6cf2174d2 Don't link shared alloc dir into task dir for raw_exec
Fixes running raw_exec tasks when nomad isn't root.
2017-01-18 11:28:34 -08:00
Michael Schurter
0785109ae4 Stop trying to use mount for image based drivers
Fixes #2178 and allows using Docker and other image based drivers even
when nomad is run as a non-root user.

`client/allocdir` tests can be run as a non-root user to ensure this
behavior and tests that rely on root or non-root users properly detect
their effective user and skip instead of fail.
2017-01-13 13:04:12 -08:00
Michael Schurter
e25274b775 Put a logger in AllocDir/TaskDir 2017-01-05 16:31:56 -08:00
Michael Schurter
957adf2df3 Add comments to TaskDir 2017-01-05 16:31:55 -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
Alex Dadgar
732cce5d4a ensure file doesn't escape 2016-12-18 15:48:30 -08:00
Diptanu Choudhury
0beb8c0856 Fixed comments 2016-11-08 12:55:15 -08:00
Diptanu Choudhury
68aedd3f8f Fixed permission issues on client 2016-11-08 10:57:29 -08:00
Alex Dadgar
b977c5558b Change folder permission event when not root 2016-10-28 16:52:38 -07:00
Diptanu Choudhury
e32a855ca6 Fixed alloc dir move tests 2016-10-26 15:17:57 -07:00
Alex Dadgar
d4aa3fb831 Disallow fs to read secret directory 2016-10-24 11:14:05 -07:00
Michael Schurter
4d3187bc7e 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
Ben Barnard
ce94317d00 Replace "the the" with "the" in documentation and comments 2016-10-11 15:31:40 -04:00
Alex Dadgar
bcb1a2e216 Do not allow path to escape the alloc dir for the FS commands 2016-10-03 14:58:44 -07:00
Diptanu Choudhury
c29861b418 Getting snapshot of allocation from remote node (#1741)
* Added the alloc dir move

* Moving allocdirs when starting allocations

* Added the migrate flag to ephemeral disk

* Stopping migration if the allocation doesn't need migration any more

* Added the GetAllocDir method

* refactored code

* Added a test for alloc runner

* Incorporated review comments
2016-10-03 09:59:57 -07:00
Diptanu Choudhury
50e3217211 Avoiding copying files if they are already present in chrootw (#1753) 2016-09-27 11:43:27 -07:00
Diptanu Choudhury
bc82dd67b5 Closing files when files are removed 2016-09-23 22:17:53 -07:00
Diptanu Choudhury
dd3af85114 Adding a snapshot endpoint on the client (#1730) 2016-09-21 21:28:12 -07:00
Alex Dadgar
bec6adb2ee Vault token threaded 2016-09-14 13:30:01 -07:00
Alex Dadgar
afee832f2c syscall error 2016-09-02 15:00:46 -07:00
Alex Dadgar
4bae54741e Secret dir materialized in alloc/task directory 2016-09-02 12:44:05 -07:00
Alex Dadgar
335cababe1 Revert "Introduce a Secret/ directory" 2016-09-01 17:23:15 -07:00
Alex Dadgar
0c050bd62b Symlink on windows 2016-08-31 21:41:44 -07:00
Alex Dadgar
0b07ef93c1 Address comments and reserve 2016-08-31 18:11:02 -07:00
Alex Dadgar
dfab22cd9f environment variables 2016-08-31 13:56:11 -07:00
Alex Dadgar
46ce8dd020 Interface + tests 2016-08-30 21:40:32 -07:00
Alex Dadgar
0ebdff2bb7 Secret dir, hello world 2016-08-29 15:41:52 -07:00
Alex Dadgar
b813362ece Make maxSize exported so that it is serialized 2016-08-28 17:48:35 -07:00
Ivo Verberk
0d13488f1f Monitor the complete alloc directory, not just the shared part. 2016-08-25 20:48:19 +02:00
Ivo Verberk
13071e9846 Disk resource monitoring and enforcement 2016-08-18 07:59:03 +02:00
Alex Dadgar
17b9e7ddb4 only use polling 2016-08-11 18:59:48 -07:00
Alex Dadgar
cc0fec53f1 initial log api impl 2016-07-25 11:16:01 -07:00
Diptanu Choudhury
51149e4381 Merge pull request #1321 from mwieczorek/f-windows-binds
Volume binds for windows containers
2016-07-18 10:20:44 -06:00
Alex Dadgar
887a2e947f Merge pull request #1404 from hashicorp/f-streaming
Implement a streaming API and tail in the fs command
2016-07-12 17:23:04 -06:00
Alex Dadgar
19ca6e7b55 address comments 2016-07-12 17:01:33 -06:00
Sean Chittenden
444998cc37 Darwin currently has allocdir support.
Pointed out by: @dadgar
2016-07-11 12:19:17 -07:00
Alex Dadgar
3cc13aeca1 initial comments 2016-07-11 10:58:18 -06:00
Sean Chittenden
572925a5fa Fix test for non-Linux platforms.
The following tests now check a whitelist for whether or not their
driver is present or not, or if the OS is supported or not.

* `TestAllocDir_MountSharedAlloc`
* `TestClient_Drivers_InWhitelist` (`exec` driver)
* `TestClient_Drivers` (`exec` driver)
* `TestJavaDriver_Fingerprint` (`java` driver)
2016-07-10 15:19:49 -07:00
Alex Dadgar
2368722146 initial tail impl 2016-07-10 13:57:04 -04:00
Michal Wieczorek
ff6a5aa799 Volume binds for windows containers 2016-06-20 21:46:33 +02:00
Sean Chittenden
29be52f762 Speling police 2016-05-15 09:41:34 -07:00
Sean Chittenden
7a2bd507e7 Merge pull request #1160 from hashicorp/f-freebsd
Stubbed out raw_exec support for *NIX platforms

OOB LGTM: @diptanu
2016-05-11 12:54:27 -07:00
Diptanu Choudhury
a84ace5136 Merge pull request #1164 from hashicorp/fix-unmount
Removing directories only if we could successfully unmount them
2016-05-11 12:51:34 -07:00
Diptanu Choudhury
dc38906809 Removing directories only if we could successfully unmount them 2016-05-10 14:57:16 -07:00
Sean Chittenden
0fdb16af99 Stub out FreeBSD support for Nomad
Compiles, but is not functional (yet).
2016-05-09 11:56:35 -07:00
Sean Chittenden
bfa8284531 Prefer golang.org/x/sys/unix where appropriate
Favor the `unix` package on *NIX platforms vs the now frozen `syscall` package.
2016-05-07 11:01:45 -07:00
Sean Chittenden
9cb16b5b9e Explicitly enumaret the build targets in _unix
`!windows` was being used as the synonym for `darwin dragonfly freebsd linux netbsd openbsd solaris`.  While I don't imagine `android` will be a prime target for Nomad in the near term, favor explicit build targets.

List of build targets generated by Go 1.7's dist command: `go tool dist list | sort | cut -d '/' -f 1 | sort | uniq`
2016-05-07 10:42:01 -07:00
Sean Chittenden
146c4e8fd6 Rename from posix to unix to parallel x/sys/unix
Use the `_unix` file suffix to denote *NIX-like semantics in order to parallel the designation given by the package `golang.org/x/sys/unix`.
2016-05-07 10:33:43 -07:00