mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-06 16:17:14 +00:00
Merge pull request #7437 from Lyndon-Li/issue-fix-7036
Issue 7036: node selection for data mover backup
This commit is contained in:
@@ -121,6 +121,15 @@ func IsPodUnrecoverable(pod *corev1api.Pod, log logrus.FieldLogger) (bool, strin
|
||||
return true, fmt.Sprintf("Pod is in abnormal state %s", pod.Status.Phase)
|
||||
}
|
||||
|
||||
if pod.Status.Phase == corev1api.PodPending && len(pod.Status.Conditions) > 0 {
|
||||
for _, condition := range pod.Status.Conditions {
|
||||
if condition.Type == corev1api.PodScheduled && condition.Reason == "Unschedulable" {
|
||||
log.Warnf("Pod is unschedulable %s", condition.Message)
|
||||
return true, fmt.Sprintf("Pod is unschedulable: %s", condition.Message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check the Status field
|
||||
for _, containerStatus := range pod.Status.ContainerStatuses {
|
||||
// If the container's image state is ImagePullBackOff, it indicates an image pull failure
|
||||
|
||||
@@ -401,6 +401,21 @@ func TestIsPodUnrecoverable(t *testing.T) {
|
||||
},
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "pod is unschedulable",
|
||||
pod: &corev1api.Pod{
|
||||
Status: corev1api.PodStatus{
|
||||
Phase: corev1api.PodPending,
|
||||
Conditions: []corev1api.PodCondition{
|
||||
{
|
||||
Type: corev1api.PodScheduled,
|
||||
Reason: "Unschedulable",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "pod is normal",
|
||||
pod: &corev1api.Pod{
|
||||
|
||||
Reference in New Issue
Block a user