Skip to content

Commit

Permalink
Merge pull request vmware-tanzu#6189 from Lyndon-Li/release-1.11
Browse files Browse the repository at this point in the history
[1.11] Fix issue 6182
  • Loading branch information
qiuming-best authored Apr 26, 2023
2 parents 6ac0853 + d6755f7 commit dc0a712
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/6189-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue #6182. If pod is not running, don't treat it as an error, let it go and leave a warning.
21 changes: 13 additions & 8 deletions pkg/podvolume/backupper.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,28 @@ func (b *backupper) BackupPodVolumes(backup *velerov1api.Backup, pod *corev1api.
return nil, nil
}

repositoryType := getRepositoryType(b.uploaderType)
if repositoryType == "" {
err := errors.Errorf("empty repository type, uploader %s", b.uploaderType)
return nil, []error{err}
err := kube.IsPodRunning(pod)
if err != nil {
for _, volumeName := range volumesToBackup {
err = errors.Wrapf(err, "backup for volume %s is skipped", volumeName)
log.WithError(err).Warn("Skip pod volume")
}

return nil, nil
}

repo, err := b.repoEnsurer.EnsureRepo(b.ctx, backup.Namespace, pod.Namespace, backup.Spec.StorageLocation, repositoryType)
err = nodeagent.IsRunningInNode(b.ctx, backup.Namespace, pod.Spec.NodeName, b.podClient)
if err != nil {
return nil, []error{err}
}

err = kube.IsPodRunning(pod)
if err != nil {
repositoryType := getRepositoryType(b.uploaderType)
if repositoryType == "" {
err := errors.Errorf("empty repository type, uploader %s", b.uploaderType)
return nil, []error{err}
}

err = nodeagent.IsRunningInNode(b.ctx, backup.Namespace, pod.Spec.NodeName, b.podClient)
repo, err := b.repoEnsurer.EnsureRepo(b.ctx, backup.Namespace, pod.Namespace, backup.Spec.StorageLocation, repositoryType)
if err != nil {
return nil, []error{err}
}
Expand Down

0 comments on commit dc0a712

Please sign in to comment.