fix: add nil check for storage class name
Signed-off-by: stoneshi-yunify <70880165+stoneshi-yunify@users.noreply.github.com>
This commit is contained in:
@@ -107,7 +107,7 @@ func (s *storageClassesSearcher) countPersistentVolumeClaims(name string) int {
|
|||||||
var count int
|
var count int
|
||||||
|
|
||||||
for _, pvc := range pvcs {
|
for _, pvc := range pvcs {
|
||||||
if *pvc.Spec.StorageClassName == name || (pvc.Annotations != nil && pvc.Annotations[corev1.BetaStorageClassAnnotation] == name) {
|
if (pvc.Spec.StorageClassName != nil && *pvc.Spec.StorageClassName == name) || (pvc.Annotations != nil && pvc.Annotations[corev1.BetaStorageClassAnnotation] == name) {
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user