Skip to content

Annotate pod in all states, to allow backup volume with pending pods … #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Loading