Merge pull request #89646 from zhouya0/fix_kubectl_describe_CSINode_nil_pointer

Fix kubectl describe CSINode nil pointer error
This commit is contained in:
Kubernetes Prow Robot 2020-03-30 11:00:18 -07:00 committed by GitHub
commit 933c303592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4031,10 +4031,14 @@ func describeCSINode(csi *storagev1.CSINode, events *corev1.EventList) (output s
w.Write(LEVEL_1, "Drivers:\n")
for _, driver := range csi.Spec.Drivers {
w.Write(LEVEL_2, "%s:\n", driver.Name)
w.Write(LEVEL_3, "Allocatables:\n")
w.Write(LEVEL_4, "Count:\t%d\n", *driver.Allocatable.Count)
w.Write(LEVEL_3, "Node ID:\t%s\n", driver.NodeID)
w.Write(LEVEL_3, "Topology Keys:\t%s\n", driver.TopologyKeys)
if driver.Allocatable.Count != nil {
w.Write(LEVEL_3, "Allocatables:\n")
w.Write(LEVEL_4, "Count:\t%d\n", *driver.Allocatable.Count)
}
if driver.TopologyKeys != nil {
w.Write(LEVEL_3, "Topology Keys:\t%s\n", driver.TopologyKeys)
}
}
}
if events != nil {