diff --git a/.changelog/17911.txt b/.changelog/17911.txt new file mode 100644 index 000000000..eaf54e5f8 --- /dev/null +++ b/.changelog/17911.txt @@ -0,0 +1,3 @@ +```release-note:improvement +cli: Display volume namespace on `nomad volume status` and `nomad node status` output +``` diff --git a/command/node_status.go b/command/node_status.go index c48d81d38..46bd41384 100644 --- a/command/node_status.go +++ b/command/node_status.go @@ -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, diff --git a/command/volume_status.go b/command/volume_status.go index 7fe5ed0a3..d396b59a9 100644 --- a/command/volume_status.go +++ b/command/volume_status.go @@ -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) } diff --git a/command/volume_status_csi.go b/command/volume_status_csi.go index 98c37b1ed..f6ba7d275 100644 --- a/command/volume_status_csi.go +++ b/command/volume_status_csi.go @@ -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), diff --git a/website/content/docs/commands/node/status.mdx b/website/content/docs/commands/node/status.mdx index 2d038b997..d6c2488c1 100644 --- a/website/content/docs/commands/node/status.mdx +++ b/website/content/docs/commands/node/status.mdx @@ -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 +ID Name Namespace Plugin ID Schedulable Access Mode Mount Options +402f2c83 vol default plug true single-node-writer Drivers Driver Detected Healthy Message Time diff --git a/website/content/docs/commands/volume/status.mdx b/website/content/docs/commands/volume/status.mdx index d371d7f45..bc8088789 100644 --- a/website/content/docs/commands/volume/status.mdx +++ b/website/content/docs/commands/volume/status.mdx @@ -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