Backport of cli: search all namespaces for node volumes into release/1.6.x (#18119)
This pull request was automerged via backport-assistant
This commit is contained in:
parent
b75f552246
commit
3b076edf11
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
cli: Fixed a bug that prevented CSI volumes in namespaces other than `default` from being displayed in the `nomad node status -verbose` output
|
||||||
|
```
|
|
@ -687,7 +687,9 @@ func (c *NodeStatusCommand) outputNodeCSIVolumeInfo(client *api.Client, node *ap
|
||||||
// Fetch the volume objects with current status
|
// Fetch the volume objects with current status
|
||||||
// Ignore an error, all we're going to do is omit the volumes
|
// Ignore an error, all we're going to do is omit the volumes
|
||||||
volumes := map[string]*api.CSIVolumeListStub{}
|
volumes := map[string]*api.CSIVolumeListStub{}
|
||||||
vs, _ := client.Nodes().CSIVolumes(node.ID, nil)
|
vs, _ := client.Nodes().CSIVolumes(node.ID, &api.QueryOptions{
|
||||||
|
Namespace: "*",
|
||||||
|
})
|
||||||
for _, v := range vs {
|
for _, v := range vs {
|
||||||
n, ok := requests[v.ID]
|
n, ok := requests[v.ID]
|
||||||
if ok {
|
if ok {
|
||||||
|
@ -700,15 +702,14 @@ func (c *NodeStatusCommand) outputNodeCSIVolumeInfo(client *api.Client, node *ap
|
||||||
|
|
||||||
// Output the volumes in name order
|
// Output the volumes in name order
|
||||||
output := make([]string, 0, len(names)+1)
|
output := make([]string, 0, len(names)+1)
|
||||||
output = append(output, "ID|Name|Namespace|Plugin ID|Schedulable|Provider|Access Mode")
|
output = append(output, "ID|Name|Plugin ID|Schedulable|Provider|Access Mode")
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
v, ok := volumes[name]
|
v, ok := volumes[name]
|
||||||
if ok {
|
if ok {
|
||||||
output = append(output, fmt.Sprintf(
|
output = append(output, fmt.Sprintf(
|
||||||
"%s|%s|%s|%s|%t|%s|%s",
|
"%s|%s|%s|%t|%s|%s",
|
||||||
v.ID,
|
v.ID,
|
||||||
name,
|
name,
|
||||||
v.Namespace,
|
|
||||||
v.PluginID,
|
v.PluginID,
|
||||||
v.Schedulable,
|
v.Schedulable,
|
||||||
v.Provider,
|
v.Provider,
|
||||||
|
|
|
@ -187,12 +187,11 @@ func (c *VolumeStatusCommand) csiFormatVolumes(vols []*api.CSIVolumeListStub) (s
|
||||||
// Format the volumes, assumes that we're already sorted by volume ID
|
// Format the volumes, assumes that we're already sorted by volume ID
|
||||||
func csiFormatSortedVolumes(vols []*api.CSIVolumeListStub) (string, error) {
|
func csiFormatSortedVolumes(vols []*api.CSIVolumeListStub) (string, error) {
|
||||||
rows := make([]string, len(vols)+1)
|
rows := make([]string, len(vols)+1)
|
||||||
rows[0] = "ID|Name|Namespace|Plugin ID|Schedulable|Access Mode"
|
rows[0] = "ID|Name|Plugin ID|Schedulable|Access Mode"
|
||||||
for i, v := range vols {
|
for i, v := range vols {
|
||||||
rows[i+1] = fmt.Sprintf("%s|%s|%s|%s|%t|%s",
|
rows[i+1] = fmt.Sprintf("%s|%s|%s|%t|%s",
|
||||||
v.ID,
|
v.ID,
|
||||||
v.Name,
|
v.Name,
|
||||||
v.Namespace,
|
|
||||||
v.PluginID,
|
v.PluginID,
|
||||||
v.Schedulable,
|
v.Schedulable,
|
||||||
v.AccessMode,
|
v.AccessMode,
|
||||||
|
|
Loading…
Reference in New Issue