volume-status : show namespace the volume belongs to (#17911)

* volume-status : show namespace the volume belongs to

Re-apply changes reverted by 950235df48869e0f3f1dc8950dc430394ababa85
This commit is contained in:
Nando 2023-07-19 22:36:51 +02:00 committed by Luiz Aoqui
parent 0fb0054e60
commit 66809615f4
2 changed files with 6 additions and 4 deletions

View File

@ -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,

View File

@ -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,