diff --git a/pkg/tools/pv.go b/pkg/tools/pv.go index 019fde4..0828972 100644 --- a/pkg/tools/pv.go +++ b/pkg/tools/pv.go @@ -50,12 +50,14 @@ func PVCPodUsage(ctx context.Context, clientset *clientkubernetes.Clientset, nam } for _, pod := range podList.Items { - for _, volume := range pod.Spec.Volumes { - if volume.PersistentVolumeClaim != nil && volume.PersistentVolumeClaim.ClaimName == pvcName { - pods = append(pods, pod.Name) - node = pod.Spec.NodeName - - break + if pod.Status.Phase != corev1.PodPending { + for _, volume := range pod.Spec.Volumes { + if volume.PersistentVolumeClaim != nil && volume.PersistentVolumeClaim.ClaimName == pvcName { + pods = append(pods, pod.Name) + node = pod.Spec.NodeName + + break + } } } }