diff --git a/operator/backupcontroller/controller_integration_test.go b/operator/backupcontroller/controller_integration_test.go index 5fa2a583b..755f88b39 100644 --- a/operator/backupcontroller/controller_integration_test.go +++ b/operator/backupcontroller/controller_integration_test.go @@ -312,7 +312,9 @@ func (ts *BackupTestSuite) Test_GivenBackupAndMountedRWOPVCOnOneNode_ExpectBacku pvc1.Status.Phase = corev1.ClaimBound pvc2.Status.Phase = corev1.ClaimBound - ts.UpdateStatus(pvc1, pvc2) + pod1.Status.Phase = corev1.PodRunning + pod2.Status.Phase = corev1.PodRunning + ts.UpdateStatus(pvc1, pvc2, pod1, pod2) result := ts.whenReconciling(ts.BackupResource) ts.Assert().GreaterOrEqual(result.RequeueAfter, 30*time.Second) @@ -359,7 +361,9 @@ func (ts *BackupTestSuite) Test_GivenBackupAndMountedRWOPVCOnTwoNodes_ExpectBack pvc1.Status.Phase = corev1.ClaimBound pvc2.Status.Phase = corev1.ClaimBound - ts.UpdateStatus(pvc1, pvc2) + pod1.Status.Phase = corev1.PodRunning + pod2.Status.Phase = corev1.PodRunning + ts.UpdateStatus(pvc1, pvc2, pod1, pod2) result := ts.whenReconciling(ts.BackupResource) ts.Assert().GreaterOrEqual(result.RequeueAfter, 30*time.Second) @@ -395,7 +399,9 @@ func (ts *BackupTestSuite) Test_GivenBackupAndMountedRWOPVCOnOneNodeWithFinished ts.EnsureResources(ts.BackupResource, pvc1, pod1, pod2) pvc1.Status.Phase = corev1.ClaimBound - ts.UpdateStatus(pvc1) + pod1.Status.Phase = corev1.PodRunning + pod2.Status.Phase = corev1.PodRunning + ts.UpdateStatus(pvc1, pod1, pod2) result := ts.whenReconciling(ts.BackupResource) ts.Assert().GreaterOrEqual(result.RequeueAfter, 30*time.Second) diff --git a/operator/backupcontroller/executor.go b/operator/backupcontroller/executor.go index 6eaab8885..3744e58f3 100644 --- a/operator/backupcontroller/executor.go +++ b/operator/backupcontroller/executor.go @@ -69,8 +69,8 @@ func (b *BackupExecutor) listAndFilterPVCs(ctx context.Context, annotation strin return nil, fmt.Errorf("list pods: %w", err) } for _, pod := range pods.Items { - if pod.Status.Phase == corev1.PodSucceeded || pod.Status.Phase == corev1.PodFailed { - log.V(1).Info("Ignoring terminated Pod", "pod", pod.GetName()) + if pod.Status.Phase != corev1.PodRunning { + log.V(1).Info("Ignoring Pod which is not running", "pod", pod.GetName()) continue } for _, volume := range pod.Spec.Volumes {