Skip to content

Commit

Permalink
OADP-4308: Don't consider unschedulable pods unrecoverable
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Seago <sseago@redhat.com>
  • Loading branch information
sseago committed Jun 14, 2024
1 parent ad59306 commit 9decb91
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 41 deletions.
11 changes: 2 additions & 9 deletions pkg/exposer/csi_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}

Expand Down Expand Up @@ -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",
Expand Down
11 changes: 2 additions & 9 deletions pkg/exposer/generic_restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}

Expand All @@ -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",
Expand Down
9 changes: 1 addition & 8 deletions pkg/util/kube/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 0 additions & 15 deletions pkg/util/kube/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 9decb91

Please sign in to comment.