Skip to content

Commit

Permalink
fix: pv force migration
Browse files Browse the repository at this point in the history
Fix check POD status.
Pod pending is a normal pod status in force mode.

Signed-off-by: Serge Logvinov <[email protected]>
  • Loading branch information
sergelogvinov committed Apr 13, 2024
1 parent ac1ef92 commit 8ecf990
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/tools/pv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Expand Down

0 comments on commit 8ecf990

Please sign in to comment.