Commit Graph

33 Commits

Author SHA1 Message Date
Chris Baker
7bc951237b alloc lifecycle: 404 when attempting to stop non-existent allocation 2019-06-20 21:27:22 +00:00
Danielle Lancashire
0f3d45bab8 alloc-lifecycle: Fix restart with empty body
Currently when you submit a manual request to the alloc lifecycle API
with a version of Curl that will submit empty bodies, the alloc restart
api will fail with an EOF error.

This behaviour is undesired, as it is reasonable to not submit a body at
all when restarting an entire allocation rather than an individual task.

This fixes it by ignoring EOF (not unexpected EOF) errors and treating
them as entire task restarts.
2019-06-12 15:35:00 +02:00
Mahmood Ali
bfb4f0ca2d agent: add websocket handler for nomad exec
This adds a websocket endpoint for handling `nomad exec`.

The endpoint is a websocket interface, as we require a bi-directional
streaming (to handle both input and output), which is not very appropriate for
plain HTTP 1.0. Using websocket makes implementing the web ui a bit simpler. I
considered using golang http hijack capability to treat http request as a plain
connection, but the web interface would be too complicated potentially.

Furthermore, the API endpoint operates against the raw core nomad exec streaming
datastructures, defined in protobuf, with json serializer.  Our APIs use json
interfaces in general, and protobuf generates json friendly golang structs.
Reusing the structs here simplify interface and reduce conversion overhead.
2019-05-09 16:49:08 -04:00
Danielle Lancashire
023d0dff31 allocs: Add nomad alloc signal command
This command will be used to send a signal to either a single task within an
allocation, or all of the tasks if <task-name> is omitted. If the sent signal
terminates the allocation, it will be treated as if the allocation has crashed,
rather than as if it was operator-terminated.

Signal validation is currently handled by the driver itself and nomad
does not attempt to restrict or validate them.
2019-04-25 12:43:32 +02:00
Danielle Lancashire
bb142af5d6 allocs: Add nomad alloc stop
This adds a `nomad alloc stop` command that can be used to stop and
force migrate an allocation to a different node.

This is built on top of the AllocUpdateDesiredTransitionRequest and
explicitly limits the scope of access to that transition to expose it
under the alloc-lifecycle ACL.

The API returns the follow up eval that can be used as part of
monitoring in the CLI or parsed and used in an external tool.
2019-04-23 12:50:23 +02:00
Danielle Lancashire
419d70c5f9 allocs: Add nomad alloc restart
This adds a `nomad alloc restart` command and api that allows a job operator
with the alloc-lifecycle acl to perform an in-place restart of a Nomad
allocation, or a given subtask.
2019-04-11 14:25:49 +02:00
Alex Dadgar
4f332ff1c2 feedback and rebasing 2018-02-15 13:59:03 -08:00
Alex Dadgar
0fb2b5c3f3 HTTP agent 2018-02-15 13:59:03 -08:00
Preetha Appan
bbeb658831 Populate DisplayMessage in various http endpoints that return allocations, plus unit tests. 2017-11-17 14:53:26 -06:00
Michael Schurter
ec43315e13 Fix regression by returning error on unknown alloc 2017-11-01 15:16:38 -05:00
Michael Schurter
9c1e595e2e Fix GC'd alloc tracking
The Client.allocs map now contains all AllocRunners again, not just
un-GC'd AllocRunners. Client.allocs is only pruned when the server GCs
allocs.

Also stops logging "marked for GC" twice.
2017-11-01 15:16:38 -05:00
Chelsea Holland Komlo
1b6f6e598a fixups from code review
change creation of a migrate token to be for a previous allocation
2017-10-11 17:13:50 -07:00
Chelsea Holland Komlo
2368068355 fixing up code review comments 2017-10-11 17:09:20 -07:00
Chelsea Holland Komlo
fba1653057 Add functionality for authenticated volumes 2017-10-11 17:09:20 -07:00
Michael Schurter
a4026229ab /v1/client/allocation/./{stats,gc} ACL enforcement 2017-10-09 12:13:52 -07:00
Michael Schurter
e83cece0d6 /v1/client/gc ACL enforcement 2017-10-06 14:50:16 -07:00
Alex Dadgar
248c069652 Merge pull request #2128 from hashicorp/f-dispatch
Nomad Constructor Jobs and Dispatch
2017-01-06 05:22:49 +08:00
Diptanu Choudhury
7ebe4a6972 Added comments 2016-12-20 10:49:48 -08:00
Diptanu Choudhury
615fbbe17a Added a garbage collector for allocations 2016-12-14 15:01:12 -08:00
Alex Dadgar
e495eecece Rename structs 2016-12-14 14:28:43 -08:00
Alex Dadgar
d978c008d3 Decompress 2016-11-28 16:05:56 -08:00
Diptanu Choudhury
dd3af85114 Adding a snapshot endpoint on the client (#1730) 2016-09-21 21:28:12 -07:00
Alex Dadgar
020f8b05d3 only support latest and remove ring buffer 2016-06-12 09:32:38 -07:00
Alex Dadgar
1a7df4e7d2 Allocation resources returned in a struct 2016-06-11 21:04:10 -07:00
Diptanu Choudhury
c760d5910f Renamed error message in alloc endpoint 2016-05-28 20:03:52 -07:00
Diptanu Choudhury
0782803543 Added a test for alloc stats api endpoint 2016-05-28 19:59:20 -07:00
Diptanu Choudhury
15e79c3783 Changing the api of the stats endpoints 2016-05-28 19:59:20 -07:00
Diptanu Choudhury
f16191c297 comments 2016-05-28 19:59:20 -07:00
Diptanu Choudhury
31af4e0ac4 Changed signature of Allocation Stats Reporter 2016-05-28 19:59:20 -07:00
Diptanu Choudhury
b755ab9341 Changed the stats endpoints 2016-05-28 19:59:20 -07:00
Armon Dadgar
e5c7effaa9 http: list results are never null 2015-09-07 10:03:10 -07:00
Armon Dadgar
3770a8929a http: adding alloc lookup endpoint 2015-09-06 15:49:44 -07:00
Armon Dadgar
57a69685a2 http: adding allocs list endpoint 2015-09-06 15:37:21 -07:00