mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
volume-status : show namespace the volume belongs to (#17911)
* volume-status : show namespace the volume belongs to
This commit is contained in:
3
.changelog/17911.txt
Normal file
3
.changelog/17911.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:improvement
|
||||
cli: Display volume namespace on `nomad volume status` and `nomad node status` output
|
||||
```
|
||||
@@ -700,14 +700,15 @@ func (c *NodeStatusCommand) outputNodeCSIVolumeInfo(client *api.Client, node *ap
|
||||
|
||||
// Output the volumes in name order
|
||||
output := make([]string, 0, len(names)+1)
|
||||
output = append(output, "ID|Name|Plugin ID|Schedulable|Provider|Access Mode")
|
||||
output = append(output, "ID|Name|Namespace|Plugin ID|Schedulable|Provider|Access Mode")
|
||||
for _, name := range names {
|
||||
v, ok := volumes[name]
|
||||
if ok {
|
||||
output = append(output, fmt.Sprintf(
|
||||
"%s|%s|%s|%t|%s|%s",
|
||||
"%s|%s|%s|%s|%t|%s|%s",
|
||||
v.ID,
|
||||
name,
|
||||
v.Namespace,
|
||||
v.PluginID,
|
||||
v.Schedulable,
|
||||
v.Provider,
|
||||
|
||||
@@ -45,13 +45,13 @@ Status Options:
|
||||
queried, and drops verbose information about allocations.
|
||||
|
||||
-verbose
|
||||
Display full allocation information.
|
||||
Display full volumes information.
|
||||
|
||||
-json
|
||||
Output the allocation in its JSON format.
|
||||
Output the volumes in JSON format.
|
||||
|
||||
-t
|
||||
Format and display allocation using a Go template.
|
||||
Format and display volumes using a Go template.
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
}
|
||||
|
||||
@@ -187,11 +187,12 @@ func (c *VolumeStatusCommand) csiFormatVolumes(vols []*api.CSIVolumeListStub) (s
|
||||
// Format the volumes, assumes that we're already sorted by volume ID
|
||||
func csiFormatSortedVolumes(vols []*api.CSIVolumeListStub) (string, error) {
|
||||
rows := make([]string, len(vols)+1)
|
||||
rows[0] = "ID|Name|Plugin ID|Schedulable|Access Mode"
|
||||
rows[0] = "ID|Name|Namespace|Plugin ID|Schedulable|Access Mode"
|
||||
for i, v := range vols {
|
||||
rows[i+1] = fmt.Sprintf("%s|%s|%s|%t|%s",
|
||||
rows[i+1] = fmt.Sprintf("%s|%s|%s|%s|%t|%s",
|
||||
v.ID,
|
||||
v.Name,
|
||||
v.Namespace,
|
||||
v.PluginID,
|
||||
v.Schedulable,
|
||||
v.AccessMode,
|
||||
@@ -212,6 +213,7 @@ func (c *VolumeStatusCommand) formatBasic(vol *api.CSIVolume) (string, error) {
|
||||
output := []string{
|
||||
fmt.Sprintf("ID|%s", vol.ID),
|
||||
fmt.Sprintf("Name|%s", vol.Name),
|
||||
fmt.Sprintf("Namespace|%s", vol.Namespace),
|
||||
fmt.Sprintf("External ID|%s", vol.ExternalID),
|
||||
fmt.Sprintf("Plugin ID|%s", vol.PluginID),
|
||||
fmt.Sprintf("Provider|%s", vol.Provider),
|
||||
|
||||
@@ -334,8 +334,8 @@ Host Volumes
|
||||
Name ReadOnly Source
|
||||
|
||||
CSI Volumes
|
||||
ID Name Plugin ID Schedulable Access Mode Mount Options
|
||||
402f2c83 vol plug true single-node-writer <none>
|
||||
ID Name Namespace Plugin ID Schedulable Access Mode Mount Options
|
||||
402f2c83 vol default plug true single-node-writer <none>
|
||||
|
||||
Drivers
|
||||
Driver Detected Healthy Message Time
|
||||
|
||||
@@ -58,16 +58,16 @@ List of all volumes:
|
||||
|
||||
```shell-session
|
||||
$ nomad volume [-type csi] status
|
||||
ID Name Plugin ID Schedulable Access Mode
|
||||
ebs_prod_db1 database ebs-prod true single-node-writer
|
||||
ID Name Namespace Plugin ID Schedulable Access Mode
|
||||
ebs_prod_db1 database default ebs-prod true single-node-writer
|
||||
```
|
||||
|
||||
List of all volumes, with external provider info:
|
||||
|
||||
```shell-session
|
||||
$ nomad volume [-type csi] status -verbose
|
||||
ID Name Plugin ID Schedulable Access Mode
|
||||
ebs_prod_db1 database ebs-prod true single-node-writer
|
||||
ID Name Namespace Plugin ID Schedulable Access Mode
|
||||
ebs_prod_db1 database default ebs-prod true single-node-writer
|
||||
|
||||
External ID Condition Nodes
|
||||
vol-abcedf OK i-abc123f2,i-14a12df13
|
||||
|
||||
Reference in New Issue
Block a user