Skip to content

Commit

Permalink
Ignore terminated Pods in mapping of PVCs to Pods
Browse files Browse the repository at this point in the history
  • Loading branch information
johbo committed Jun 6, 2024
1 parent 1e7871c commit 1fe7966
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions operator/backupcontroller/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ 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())
continue
}
for _, volume := range pod.Spec.Volumes {
if volume.PersistentVolumeClaim != nil {
pvcPodMap[volume.PersistentVolumeClaim.ClaimName] = pod
Expand Down

0 comments on commit 1fe7966

Please sign in to comment.