From 5144c8954707eedcb48ce88f76c2dab3b668fd12 Mon Sep 17 00:00:00 2001 From: "adrien.deltour" Date: Thu, 18 Jul 2024 11:24:26 +0200 Subject: [PATCH] Annotate pod in all states, to allow backup volume with pending pods due to scheduling issues. --- cmd/controller/velerovolume/controller.go | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/cmd/controller/velerovolume/controller.go b/cmd/controller/velerovolume/controller.go index 5ff97ae..1bde347 100644 --- a/cmd/controller/velerovolume/controller.go +++ b/cmd/controller/velerovolume/controller.go @@ -221,19 +221,10 @@ func (c *Controller) syncHandler(key string) error { return nil } - if pod.Status.Phase == corev1.PodRunning { - // Try to add restic backup annotation to pod when it is running - err = c.addBackupAnnotationsToPod(pod) - if err != nil { - klog.Errorf("failed to add velero restic backup annotation to pod: '%s/%s', error: %s", pod.Namespace, pod.Name, err.Error()) - return err - } - } else { - // Try to remove restic backup annotation from pod when it is not running anymore - err = c.removeBackupAnnotationsFromPod(pod) - if err != nil { - return err - } + err = c.addBackupAnnotationsToPod(pod) + if err != nil { + klog.Errorf("failed to add velero restic backup annotation to pod: '%s/%s', error: %s", pod.Namespace, pod.Name, err.Error()) + return err } return nil @@ -241,10 +232,6 @@ func (c *Controller) syncHandler(key string) error { // checkPodRequirements aims to bypass pods that don't meet filter requirements func (c *Controller) checkPodRequirements(pod *corev1.Pod) bool { - // If pod is pending, we ignore it for moment - if pod.Status.Phase == corev1.PodPending { - return false - } // Drop pods controlled by excluding jobs if c.cfg.ExcludeJobs != "" {