@@ -62,20 +62,34 @@ func getPVCsFromPod(pod *corev1.Pod) ([]PersistentVolumeClaim, error) {
62
62
}
63
63
var boundPV * PersistentVolume
64
64
if pv != nil {
65
+ var storageCapacity int64
66
+ stor := pv .Spec .Capacity .Storage ()
67
+ if stor != nil {
68
+ storageCapacity = stor .Value ()
69
+ }
65
70
boundPV = & PersistentVolume {
66
71
Name : pv .Name ,
67
72
Phase : string (pv .Status .Phase ),
68
73
StorageClass : pv .Spec .StorageClassName ,
69
- Capacity : pv . Spec . Capacity . Storage (). Value () ,
74
+ Capacity : storageCapacity ,
70
75
ReclaimPolicy : string (pv .Spec .PersistentVolumeReclaimPolicy ),
71
76
}
72
77
}
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
+ }
73
87
list = append (list , PersistentVolumeClaim {
74
88
Name : pvc .Name ,
75
89
Namespace : pvc .Namespace ,
76
90
Phase : string (pvc .Status .Phase ),
77
- StorageClass : * pvc . Spec . StorageClassName ,
78
- Capacity : pvc . Spec . Resources . Requests . Storage (). Value () ,
91
+ StorageClass : storageClass ,
92
+ Capacity : storageCapacity ,
79
93
BoundPV : boundPV ,
80
94
})
81
95
}
0 commit comments