Skip to content

Commit 55c455e

Browse files
committed
Fix kubectl describe CSINode nil pointer error
1 parent a329e67 commit 55c455e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

staging/src/k8s.io/kubectl/pkg/describe/describe.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4031,10 +4031,14 @@ func describeCSINode(csi *storagev1.CSINode, events *corev1.EventList) (output s
40314031
w.Write(LEVEL_1, "Drivers:\n")
40324032
for _, driver := range csi.Spec.Drivers {
40334033
w.Write(LEVEL_2, "%s:\n", driver.Name)
4034-
w.Write(LEVEL_3, "Allocatables:\n")
4035-
w.Write(LEVEL_4, "Count:\t%d\n", *driver.Allocatable.Count)
40364034
w.Write(LEVEL_3, "Node ID:\t%s\n", driver.NodeID)
4037-
w.Write(LEVEL_3, "Topology Keys:\t%s\n", driver.TopologyKeys)
4035+
if driver.Allocatable.Count != nil {
4036+
w.Write(LEVEL_3, "Allocatables:\n")
4037+
w.Write(LEVEL_4, "Count:\t%d\n", *driver.Allocatable.Count)
4038+
}
4039+
if driver.TopologyKeys != nil {
4040+
w.Write(LEVEL_3, "Topology Keys:\t%s\n", driver.TopologyKeys)
4041+
}
40384042
}
40394043
}
40404044
if events != nil {

0 commit comments

Comments
 (0)