Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions cmd/controller/velerovolume/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,30 +221,17 @@ 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
}

// 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 != "" {
Expand Down