mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-19 22:44:21 +00:00
issue 7036: fail early by peek expose
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
@@ -123,9 +123,9 @@ func IsPodUnrecoverable(pod *corev1api.Pod, log logrus.FieldLogger) (bool, strin
|
||||
|
||||
if pod.Status.Phase == corev1api.PodPending && len(pod.Status.Conditions) > 0 {
|
||||
for _, condition := range pod.Status.Conditions {
|
||||
if condition.Type == "PodScheduled" && condition.Reason == "Unschedulable" {
|
||||
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)
|
||||
return true, fmt.Sprintf("Pod is unschedulable: %s", condition.Message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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