CSI: sort capabilities in `plugin status` (#12154)

Also fix `LIST_SNAPSHOTS` capability name
This commit is contained in:
Tim Gross 2022-03-01 07:59:31 -05:00 committed by GitHub
parent ca06f6153a
commit 99d03cdc6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

3
.changelog/12154.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
csi: Sort allocations in `plugin status` output
```

View File

@ -148,7 +148,7 @@ func (c *PluginStatusCommand) formatControllerCaps(controllers map[string]*api.C
caps = append(caps, "CREATE_DELETE_SNAPSHOT")
fallthrough
case info.SupportsListSnapshots:
caps = append(caps, "CREATE_LIST_SNAPSHOTS")
caps = append(caps, "LIST_SNAPSHOTS")
fallthrough
case info.SupportsClone:
caps = append(caps, "CLONE_VOLUME")
@ -177,7 +177,7 @@ func (c *PluginStatusCommand) formatControllerCaps(controllers map[string]*api.C
return ""
}
return strings.Join(caps, "\n\t")
return " " + strings.Join(sort.StringSlice(caps), "\n ")
}
func (c *PluginStatusCommand) formatNodeCaps(nodes map[string]*api.CSIInfo) string {
@ -205,5 +205,5 @@ func (c *PluginStatusCommand) formatNodeCaps(nodes map[string]*api.CSIInfo) stri
return ""
}
return " " + strings.Join(caps, "\n ")
return " " + strings.Join(sort.StringSlice(caps), "\n ")
}