CLI Allow querying all namespaces for jobs and allocations - Try 2 #8192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is attempt 2 of #8183 .
This is almost the same approach, but reuses current namespace field but with specially handling
*
to mean all namespaces.UX
When
-namespace=*
command line argument is set, or ifNOMAD_NAMESPACES
env var is set to*
,nomad job
andnomad alloc
commands will lookup relevant jobs/allocations in all namespaces they are authorized to.nomad job status -namespace=*
will emit all the jobs across namespaces (with a namespace column added).nomad job status -namespace=* foo
will return the job info forfoo
job regardless of which namespace is in; if there multiple foo jobs, the CLI will emit back an error message, indicating the possible values.Implementation
The implementation is very identical to other approach
Trade-offs?
The advantage of this approach is that it's simpler to explain, has fewer moving parts, and provides a simple generalizable approach for other fields.
The downside though is that operators may need to fine tune
namespace
parameter in invocation basis. If a user setsNOMAD_NAMESPACE=*
, they may get odd errors if hitting endpoints that don't support this yet (e.g. evals). Though, we should try to extend them to eliminate this annoying inconsistency if they exist.