Commit Graph

41 Commits

Author SHA1 Message Date
Mahmood Ali
6c414cd5f9 gofmt all the files
mostly to handle build directives in 1.17.
2021-10-01 10:14:28 -04:00
Tim Gross
78afe18966 csi: alloc status -verbose should query volume request 'source' (#9354)
The `nomad alloc status -verbose` command returns a 404 from CSI volumes
because the volume mount block in the task points back to the
`job.group.volume` block. So using the `Name` field to query is the "name" as
seen in the jobspec, and not the name of the volume that we need for querying.

Show both the job-specific name and the volume ID in the resulting output,
which clarifies the difference between the two fields and is more consistent
with the web UI.
2020-11-16 08:28:52 -05:00
Drew Bailey
7ce0b5017c Events/msgtype cleanup (#9117)
* use msgtype in upsert node

adds message type to signature for upsert node, update tests, remove placeholder method

* UpsertAllocs msg type test setup

* use upsertallocs with msg type in signature

update test usage of delete node

delete placeholder msgtype method

* add msgtype to upsert evals signature, update test call sites with test setup msg type

handle snapshot upsert eval outside of FSM and ignore eval event

remove placeholder upsertevalsmsgtype

handle job plan rpc and prevent event creation for plan

msgtype cleanup upsertnodeevents

updatenodedrain msgtype

msg type 0 is a node registration event, so set the default  to the ignore type

* fix named import

* fix signature ordering on upsertnode to match
2020-10-19 09:30:15 -04:00
James Rasell
f5567b3261 cli: move tests to use NewMockUi func. 2020-10-05 16:07:41 +02:00
Mahmood Ali
ff52961918 cli: show lifecycle info in alloc status
Display task lifecycle info in `nomad alloc status <alloc_id>` output.
I chose to embed it in the Task header and only add it for tasks with
lifecycle info.

Also, I chose to order the tasks in the following order:

1. prestart non-sidecar tasks
2. prestart sidecar tasks
3. main tasks

The tasks are sorted lexicographically within each tier.

Sample output:

```
$ nomad alloc status 6ec0eb52
ID                  = 6ec0eb52-e6c8-665c-169c-113d6081309b
Eval ID             = fb0caa98
Name                = lifecycle.cache[0]
[...]

Task "init" (prestart) is "dead"
Task Resources
CPU        Memory       Disk     Addresses
0/500 MHz  0 B/256 MiB  300 MiB
[...]

Task "some-sidecar" (prestart sidecar) is "running"
Task Resources
CPU        Memory          Disk     Addresses
0/500 MHz  68 KiB/256 MiB  300 MiB
[...]

Task "redis" is "running"
Task Resources
CPU         Memory           Disk     Addresses
10/500 MHz  984 KiB/256 MiB  300 MiB
[...]
```
2020-03-23 15:57:24 -04:00
Lang Martin
9c9a0c5eb5 csi: volume ids are only unique per namespace (#7358)
* nomad/state/schema: use the namespace compound index

* scheduler/scheduler: CSIVolumeByID interface signature namespace

* scheduler/stack: SetJob on CSIVolumeChecker to capture namespace

* scheduler/feasible: pass the captured namespace to CSIVolumeByID

* nomad/state/state_store: use namespace in csi_volume index

* nomad/fsm: pass namespace to CSIVolumeDeregister & Claim

* nomad/core_sched: pass the namespace in volumeClaimReap

* nomad/node_endpoint_test: namespaces in Claim testing

* nomad/csi_endpoint: pass RequestNamespace to state.*

* nomad/csi_endpoint_test: appropriately failed test

* command/alloc_status_test: appropriately failed test

* node_endpoint_test: avoid notTheNamespace for the job

* scheduler/feasible_test: call SetJob to capture the namespace

* nomad/csi_endpoint: ACL check the req namespace, query by namespace

* nomad/state/state_store: remove deregister namespace check

* nomad/state/state_store: remove unused CSIVolumes

* scheduler/feasible: CSIVolumeChecker SetJob -> SetNamespace

* nomad/csi_endpoint: ACL check

* nomad/state/state_store_test: remove call to state.CSIVolumes

* nomad/core_sched_test: job namespace match so claim gc works
2020-03-23 13:59:25 -04:00
Tim Gross
b4b682b7fa storage: add volumes to 'nomad alloc status' CLI (#7256)
Adds a stanza for both Host Volumes and CSI Volumes to the the CLI
output for `nomad alloc status`. Mostly relies on information already
in the API structs, but in the case where there are CSI Volumes we
need to make extra API calls to get the volume status. To reduce
overhead, these extra calls are hidden behind the `-verbose` flag.
2020-03-23 13:58:30 -04:00
Drew Bailey
6980ab0a81 Prevent nomad alloc status output inconsistency
Prevent random map ordering and sort alphabetically

better variable name
2019-11-01 14:01:32 -04:00
Arshneet Singh
e6ef8b0e88 Remove redundant assertion and replace regex matches with require 2019-04-10 10:34:10 -05:00
Arshneet Singh
ec49fff549 Don't display node name if output isn't verbose. Add tests. 2019-04-10 10:34:10 -05:00
Nick Ethier
457ce6ca1b fix tests 2018-12-20 01:05:17 -05:00
Preetha Appan
4a35d62887 Fix formatting of allocation score metrics 2018-10-30 12:03:23 -05:00
Preetha Appan
d40338c8b9 Move topk and delay heap to separate packages under lib 2018-09-04 16:10:11 -05:00
Preetha Appan
aa2b632a44 Fix linting 2018-09-04 16:10:11 -05:00
Preetha Appan
4d68d935e4 Use heap to store top K scoring nodes.
Scoring metadata is now aggregated by scorer type to make it easier
to parse when reading it in the CLI.
2018-09-04 16:10:11 -05:00
Nick Ethier
4a4ed06db1 command: update tests to check for new error message 2018-04-18 13:51:17 -04:00
Preetha Appan
953d5d9df3 Code review feedback 2018-01-31 09:58:05 -06:00
Preetha Appan
fc926c96d0 Flaky contains check replaced with regex 2018-01-31 09:58:05 -06:00
Preetha Appan
d047a24867 Always show reschedule tracking and next alloc id in alloc status 2018-01-31 09:58:05 -06:00
Preetha Appan
421533341d Show info about remaining reschedule attempts relative to alloc modify time 2018-01-31 09:58:05 -06:00
Preetha Appan
ca83498e90 Show some information about rescheduling in alloc-status cli 2018-01-31 09:58:05 -06:00
Preetha Appan
33475d169a New pretty printer that imitates the short form from time.Duration.String() with approximated values for days and beyond. Used in cli output for allocation create/modify times 2017-11-01 15:16:38 -05:00
Alex Dadgar
e3710a991e add prefix tests 2017-08-29 10:09:30 -07:00
Alex Dadgar
01f584a9d8 Remove tests checking autocomplete only does 1 arg 2017-08-28 15:42:32 -07:00
Alex Dadgar
40b5158fb8 update older autocomplete tests to inject state 2017-08-22 13:33:12 -07:00
Chelsea Holland Komlo
ca6562adbd tab completion should only happen once 2017-08-16 17:04:47 +00:00
Chelsea Holland Komlo
af2f20f1bf tests for autocomplete functions 2017-08-15 20:21:50 +00:00
Alex Dadgar
a77c6a4f71 Parallel 2017-07-20 21:24:21 -07:00
Alex Dadgar
da25a3d5ce Switch to in-process agent 2017-07-20 21:07:32 -07:00
Alex Dadgar
6639f31c4a Fix some commands test 2017-07-07 12:11:39 -07:00
Alex Dadgar
7515f778a9 Thread through warnings about deprecations 2017-05-09 20:52:47 -07:00
Diptanu Choudhury
a709731258 Updated changelog and fixed tests 2016-12-20 11:32:17 -08:00
Diptanu Choudhury
5036f24591 Attempting to fix alloc status test 2016-08-22 15:07:49 -05:00
Alex Dadgar
467fa9c6fa format error 2016-08-19 16:16:15 -07:00
Cameron Davison
89d3feb420 add Created At to nomad alloc-status 2016-08-18 21:25:32 -05:00
Kenjiro Nakayama
7d804a41c7 Add test to check both -json and -t are not specified 2016-08-09 21:06:20 +09:00
Ivo Verberk
cc4fea99fc Provide a consistent user experience with prefix based lookups.
* Require at least two characters for identifier
* Automatically strip off the last character in case of uneven length
2016-01-21 22:21:35 +01:00
Ivo Verberk
de3bc00a00 Detect a half-byte prefix and display a user-friendly error. 2016-01-21 20:53:05 +01:00
Ivo Verberk
905742249e Refactoring continued
* Refactor other cli commands to new design
* Add PrefixList method to api package
* Add more tests
2015-12-24 20:53:37 +01:00
Ryan Uber
a274e0e05b command: better test for alloc-status 2015-09-27 14:42:04 -07:00
Ryan Uber
e1c4fcf721 command: first pass at alloc-status command 2015-09-27 12:02:14 -07:00