Backport of volume-status : show namespace the volume belongs to into release/1.6.x (#17997)
This pull request was automerged via backport-assistant
This commit is contained in:
parent
e5fb6fe687
commit
3011314f23
|
@ -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 the volumes in name order
|
||||||
output := make([]string, 0, len(names)+1)
|
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 {
|
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|%t|%s|%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,
|
||||||
|
|
|
@ -45,13 +45,13 @@ Status Options:
|
||||||
queried, and drops verbose information about allocations.
|
queried, and drops verbose information about allocations.
|
||||||
|
|
||||||
-verbose
|
-verbose
|
||||||
Display full allocation information.
|
Display full volumes information.
|
||||||
|
|
||||||
-json
|
-json
|
||||||
Output the allocation in its JSON format.
|
Output the volumes in JSON format.
|
||||||
|
|
||||||
-t
|
-t
|
||||||
Format and display allocation using a Go template.
|
Format and display volumes using a Go template.
|
||||||
`
|
`
|
||||||
return strings.TrimSpace(helpText)
|
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
|
// 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|Plugin ID|Schedulable|Access Mode"
|
rows[0] = "ID|Name|Namespace|Plugin ID|Schedulable|Access Mode"
|
||||||
for i, v := range vols {
|
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.ID,
|
||||||
v.Name,
|
v.Name,
|
||||||
|
v.Namespace,
|
||||||
v.PluginID,
|
v.PluginID,
|
||||||
v.Schedulable,
|
v.Schedulable,
|
||||||
v.AccessMode,
|
v.AccessMode,
|
||||||
|
@ -212,6 +213,7 @@ func (c *VolumeStatusCommand) formatBasic(vol *api.CSIVolume) (string, error) {
|
||||||
output := []string{
|
output := []string{
|
||||||
fmt.Sprintf("ID|%s", vol.ID),
|
fmt.Sprintf("ID|%s", vol.ID),
|
||||||
fmt.Sprintf("Name|%s", vol.Name),
|
fmt.Sprintf("Name|%s", vol.Name),
|
||||||
|
fmt.Sprintf("Namespace|%s", vol.Namespace),
|
||||||
fmt.Sprintf("External ID|%s", vol.ExternalID),
|
fmt.Sprintf("External ID|%s", vol.ExternalID),
|
||||||
fmt.Sprintf("Plugin ID|%s", vol.PluginID),
|
fmt.Sprintf("Plugin ID|%s", vol.PluginID),
|
||||||
fmt.Sprintf("Provider|%s", vol.Provider),
|
fmt.Sprintf("Provider|%s", vol.Provider),
|
||||||
|
|
|
@ -334,8 +334,8 @@ Host Volumes
|
||||||
Name ReadOnly Source
|
Name ReadOnly Source
|
||||||
|
|
||||||
CSI Volumes
|
CSI Volumes
|
||||||
ID Name Plugin ID Schedulable Access Mode Mount Options
|
ID Name Namespace Plugin ID Schedulable Access Mode Mount Options
|
||||||
402f2c83 vol plug true single-node-writer <none>
|
402f2c83 vol default plug true single-node-writer <none>
|
||||||
|
|
||||||
Drivers
|
Drivers
|
||||||
Driver Detected Healthy Message Time
|
Driver Detected Healthy Message Time
|
||||||
|
|
|
@ -58,16 +58,16 @@ List of all volumes:
|
||||||
|
|
||||||
```shell-session
|
```shell-session
|
||||||
$ nomad volume [-type csi] status
|
$ nomad volume [-type csi] status
|
||||||
ID Name Plugin ID Schedulable Access Mode
|
ID Name Namespace Plugin ID Schedulable Access Mode
|
||||||
ebs_prod_db1 database ebs-prod true single-node-writer
|
ebs_prod_db1 database default ebs-prod true single-node-writer
|
||||||
```
|
```
|
||||||
|
|
||||||
List of all volumes, with external provider info:
|
List of all volumes, with external provider info:
|
||||||
|
|
||||||
```shell-session
|
```shell-session
|
||||||
$ nomad volume [-type csi] status -verbose
|
$ nomad volume [-type csi] status -verbose
|
||||||
ID Name Plugin ID Schedulable Access Mode
|
ID Name Namespace Plugin ID Schedulable Access Mode
|
||||||
ebs_prod_db1 database ebs-prod true single-node-writer
|
ebs_prod_db1 database default ebs-prod true single-node-writer
|
||||||
|
|
||||||
External ID Condition Nodes
|
External ID Condition Nodes
|
||||||
vol-abcedf OK i-abc123f2,i-14a12df13
|
vol-abcedf OK i-abc123f2,i-14a12df13
|
||||||
|
|
Loading…
Reference in New Issue