Commit Graph

35 Commits

Author SHA1 Message Date
Tim Gross c38c052ef3
api: document warnings for setting `api.ClientConnTimeout` (#14122)
HTTP API consumers that have network line-of-sight to client nodes can connect
directly for a small number of APIs. But in environments where the consumer
doesn't have line-of-sight, there's a long pause waiting for the
`api.ClientConnTimeout` to expire. Warn about this in the API docs so that
authors can avoid the extra timeout.
2022-08-15 16:06:02 -04:00
Ryo Nakao e11894a0cb
Ensure to close StreamFrame channel (#12248) 2022-03-28 10:28:23 -04:00
Mahmood Ali b77fd8654b cli: recover from client ACL lookup failures
This fixes a bug in the CLI handling of node lookup failures when
querying allocation and FS endpoints.

Allocation and FS endpoint are handled by the client; one can query the
relevant client directly, or query a server to have it forwarded
transparently to relevant client.  Querying the client directly is
benefecial to avoid loading servers with IO.

As an optimization, the CLI attempts to query the client directly, but
then falls back to using server forwarding path if it encounters network
or connection errors (e.g. clients are locked down or in a separate
inaccessible network).

Here, we fix a bug where if the CLI fails to find to lookup the client
details because it lacks ACL capability or other unexpected reasons, the
CLI will not go through fallback path.
2019-10-04 11:23:59 -04:00
Preetha Appan 3345ce3ba4
Infer content type in alloc fs stat endpoint 2019-06-28 20:31:28 -05:00
Michael Schurter 949938534b api: never return EOF from Logs error chan
Closing the frames chan is the only race-free way to signal to receivers
that all frames have been sent and no errors have occurred.

If EOF is sent on error chan receivers may not receive the last frame
(or frames since the chan is buffered) before receiving the error.

Closing frames is the idiomatic way of signaling there is no more data
to be read from a chan.
2018-05-02 10:46:16 -07:00
Charlie Voiselle ba88f00ccb Changed "til" to "until"
Should be "till" or "until"; chose "until" because it is unambiguous as to meaning.
2018-04-11 12:36:28 -05:00
Alex Dadgar aa98f8ba7b Enhance API pkg to utilize Server's Client Tunnel
This PR enhances the API package by having client only RPCs route
through the server when they are low cost and for filesystem access to
first attempt a direct connection to the node and then falling back to
a server routed request.
2018-02-15 13:59:03 -08:00
Alex Dadgar 2a09c51840 handle errors when streaming logs 2017-09-19 10:37:49 -05:00
Alex Dadgar 7af98ee57c Fix logs/fs commands
This PR fixes an assignment to a nil map in the api pkg related to
accessing logs and the filesystem of allocations.

Fixes https://github.com/hashicorp/nomad/issues/3115
2017-08-28 22:21:54 -07:00
Michael Schurter b145e04d5d Refactor GetNodeClient weirdness
- No need to for a pointer to a pointer
- Properly set and use QueryOptions.Region
2017-08-28 14:41:21 -07:00
Michael Schurter 7363b50666 Fix TLS support in api pkg / cli
Fixes #3013

It's a little weird that Client now has a method for returning a
NewClient, but it's a convenient way to dedupe the logic to
connect-directly-to-a-node which is nontrivial and had sutble
differences between locations.
2017-08-28 11:46:28 -07:00
Luke Farnell f0ced87b95 fixed all spelling mistakes for goreport 2017-08-07 17:13:05 -04:00
Michael Schurter 8310032c5c Fix TLS use in AllocFS API and region/dc detection 2017-03-27 17:38:16 -07:00
Diptanu Choudhury 067fcda3fe Making the cli use TLS if the client has enabled TLS 2016-10-26 11:13:53 -07:00
Alex Dadgar ef47612606 api.fs uses the api.Client rather than making raw requests 2016-07-28 14:27:17 -07:00
Alex Dadgar 43d78b6d23 control-c works 2016-07-25 11:16:54 -07:00
Alex Dadgar 85cc520365 Support non-following logs 2016-07-25 11:16:54 -07:00
Alex Dadgar c808f2eefa remove file events and last offset 2016-07-25 11:16:01 -07:00
Alex Dadgar 605dd5cef9 unblock the readers to add liveness when using -n 2016-07-25 11:16:01 -07:00
Alex Dadgar b2df901158 initial api and command 2016-07-25 11:16:01 -07:00
Alex Dadgar 104a5baa33 Allow following of files when cating and fix offsets 2016-07-13 15:33:17 -06:00
Alex Dadgar d37651995f implement -n for tail 2016-07-13 13:26:09 -06:00
Alex Dadgar dba8a3df22 frames to reader 2016-07-12 17:34:32 -06:00
Alex Dadgar e9ffadfdc6 initial comments 2016-07-11 10:58:18 -06:00
Alex Dadgar 1fe435a130 StreamFramer encapsulates the sending, heartbeating and batching behavior of frames 2016-07-10 13:57:04 -04:00
Alex Dadgar 92a6f0f8ba initial command implementation 2016-07-10 13:57:04 -04:00
Diptanu Choudhury 9d495a4be4 Added the /fs/cat/ api 2016-03-28 11:06:22 -07:00
Diptanu Choudhury c265b610f1 Not trying to parse response if the body is not a json 2016-01-27 21:39:50 -08:00
Diptanu Choudhury 980bc19d10 Added more information about files 2016-01-27 14:20:10 -08:00
Diptanu Choudhury 4a1d4ff69a Changed the api of the ReadAt API 2016-01-27 12:53:24 -08:00
Diptanu Choudhury 2a9dd78572 Introducing an AllocFileInfo in the api package 2016-01-27 12:53:24 -08:00
Diptanu Choudhury 68c2164088 Added the cli for fs-cat 2016-01-27 12:53:23 -08:00
Diptanu Choudhury a70e5dbdc7 Added an impl for stating a file 2016-01-27 12:53:23 -08:00
Diptanu Choudhury edd3194a16 Added some comments 2016-01-27 12:53:23 -08:00
Diptanu Choudhury 1e9c817a52 Added the cli for listing alloc dir 2016-01-27 12:53:23 -08:00