Merge pull request #7899 from sseago/no-fast-fail-for-unschedulable

Don't consider unschedulable pods unrecoverable
pull/7922/head
lyndon-li 2024-06-25 10:08:51 +08:00 committed by GitHub
commit b0dc189311
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 41 deletions

View File

@ -0,0 +1 @@
Don't consider unschedulable pods unrecoverable

View File

@ -642,14 +642,7 @@ func TestPeekExpose(t *testing.T) {
Name: backup.Name,
},
Status: corev1.PodStatus{
Phase: corev1.PodPending,
Conditions: []corev1.PodCondition{
{
Type: corev1.PodScheduled,
Reason: "Unschedulable",
Message: "unrecoverable",
},
},
Phase: corev1.PodFailed,
},
}
@ -679,7 +672,7 @@ func TestPeekExpose(t *testing.T) {
kubeClientObj: []runtime.Object{
backupPodUrecoverable,
},
err: "Pod is unschedulable: unrecoverable",
err: "Pod is in abnormal state Failed",
},
{
name: "succeed",

View File

@ -429,14 +429,7 @@ func TestRestorePeekExpose(t *testing.T) {
Name: restore.Name,
},
Status: corev1api.PodStatus{
Phase: corev1api.PodPending,
Conditions: []corev1api.PodCondition{
{
Type: corev1api.PodScheduled,
Reason: "Unschedulable",
Message: "unrecoverable",
},
},
Phase: corev1api.PodFailed,
},
}
@ -463,7 +456,7 @@ func TestRestorePeekExpose(t *testing.T) {
kubeClientObj: []runtime.Object{
restorePodUrecoverable,
},
err: "Pod is unschedulable: unrecoverable",
err: "Pod is in abnormal state Failed",
},
{
name: "succeed",

View File

@ -121,14 +121,7 @@ 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)
}
}
}
// removed "Unschedulable" check since unschedulable condition isn't always permanent
// Check the Status field
for _, containerStatus := range pod.Status.ContainerStatuses {

View File

@ -401,21 +401,6 @@ 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{