-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: add operator api command #10808
Conversation
--cacert "$HOME/.nomad/ca.pem" \ | ||
--cert "$HOME/.nomad/client.pem" \ | ||
--key "$HOME/.nomad/client-key.pem" \ | ||
--connect-to "client.global.nomad:4646:remote.client123.internal:4646" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be a fair comparison I should probably reference the environment variables when possible.
--connect-to
is the really difficult one as it requires plucking the actual address out of $NOMAD_ADDR
. Not impossible, but not trivial interpolation like everything else.
Still... this entire Go command could be replaced by a fairly trivial bash
function for people to include in their profiles similar to autocompletion. Obviously that would require bash
(not guaranteed on Windows) and curl
to be installed.
Just a hackweek project at this point.
Trimmed spaces around header values. Fixed method getting forced to GET.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some random suggestions
We don't want people to expect stable error codes for errors, and I don't think these were useful for scripts anyway.
Co-authored-by: Seth Hoenig <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional random suggestions. This command is awesome 🎉
|
||
[curl]: https://curl.se/ | ||
[envvars]: /docs/commands#environment-variables | ||
[jobs]: /api-docs/jobs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The layout for this page looks different from the other commands. There're usually structured like:
Command: operator api
...
Usage
...
General Options
...
API Options
...
Output
...
Examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Fixed it up but left out Output. It seems to be often left out and is likely mostly redundant with Examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Add a new
nomad operator api <endpoint>
command to ease query Nomad's HTTP API. All of the normal CLI parameters are supported (eg-token
or-region
) as are the regular environment variables (egNOMAD_TOKEN
orNOMAD_REGION
).For production clusters with ACLs, mTLS, and federation, manually constructing the proper curl command for accessing the Nomad HTTP API is a lot of work. This aims to ease that.
The new
?filter=...
query parameter added in #12076 is also tricky to use via curl because it usually requires URL encoding the filter query. This subcommand also supports adding filters to arbitrary APIs.Future work:
I didn't alias
nomad operator ...
tonomad op ...
commands. Not sure it's worth it since most people probably have tab completion enabled? Still might be worth it for docs and scripts.Probably add a million other little features (
-stale
,-pretty
,-wait
, etc) Not sure where to draw the line for the MVP.