Skip to content

Commit

Permalink
volume-status : show namespace the volume belongs to (#17911)
Browse files Browse the repository at this point in the history
* volume-status : show namespace the volume belongs to

Re-apply changes reverted by 950235d
  • Loading branch information
the-nando authored and lgfa29 committed Aug 17, 2023
1 parent 497851e commit 7c1c9b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions command/node_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,14 +702,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,
Expand Down
5 changes: 3 additions & 2 deletions command/volume_status_csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7c1c9b0

Please sign in to comment.