@@ -62,20 +62,34 @@ func getPVCsFromPod(pod *corev1.Pod) ([]PersistentVolumeClaim, error) {
6262 }
6363 var boundPV * PersistentVolume
6464 if pv != nil {
65+ var storageCapacity int64
66+ stor := pv .Spec .Capacity .Storage ()
67+ if stor != nil {
68+ storageCapacity = stor .Value ()
69+ }
6570 boundPV = & PersistentVolume {
6671 Name : pv .Name ,
6772 Phase : string (pv .Status .Phase ),
6873 StorageClass : pv .Spec .StorageClassName ,
69- Capacity : pv . Spec . Capacity . Storage (). Value () ,
74+ Capacity : storageCapacity ,
7075 ReclaimPolicy : string (pv .Spec .PersistentVolumeReclaimPolicy ),
7176 }
7277 }
78+ var storageClass string
79+ if pvc .Spec .StorageClassName != nil {
80+ storageClass = * pvc .Spec .StorageClassName
81+ }
82+ var storageCapacity int64
83+ stor := pvc .Spec .Resources .Requests .Storage ()
84+ if stor != nil {
85+ storageCapacity = stor .Value ()
86+ }
7387 list = append (list , PersistentVolumeClaim {
7488 Name : pvc .Name ,
7589 Namespace : pvc .Namespace ,
7690 Phase : string (pvc .Status .Phase ),
77- StorageClass : * pvc . Spec . StorageClassName ,
78- Capacity : pvc . Spec . Resources . Requests . Storage (). Value () ,
91+ StorageClass : storageClass ,
92+ Capacity : storageCapacity ,
7993 BoundPV : boundPV ,
8094 })
8195 }
0 commit comments