-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Check the PVB status via podvolume Backupper rather than calling API server to avoid API server issue #8596
base: release-1.15
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-1.15 #8596 +/- ##
=============================================
Coverage 59.10% 59.10%
=============================================
Files 367 367
Lines 39141 39178 +37
=============================================
+ Hits 23134 23156 +22
- Misses 14535 14542 +7
- Partials 1472 1480 +8 ☔ View full report in Codecov by Sentry. |
033716f
to
b12df50
Compare
pkg/backup/backup.go
Outdated
pvb.Status.Phase == velerov1api.PodVolumeBackupPhaseFailed { | ||
processed = true | ||
} | ||
pvbMap[pvb] = processed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial, but the variable processed
is not needed:
pvbMap[pvb] = pvb.Status.Phase == velerov1api.PodVolumeBackupPhaseCompleted ||
pvb.Status.Phase == velerov1api.PodVolumeBackupPhaseFailed
pkg/podvolume/backupper.go
Outdated
@@ -312,6 +336,12 @@ func (b *backupper) BackupPodVolumes(backup *velerov1api.Backup, pod *corev1api. | |||
continue | |||
} | |||
b.wg.Add(1) | |||
|
|||
if err := b.pvbIndexer.Add(volumeBackup); err != nil { | |||
errs = append(errs, errors.Wrapf(err, "failed to create PodVolumeBackup for pvc %s", pvc.Spec.VolumeName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it the write error message?
Shouldn't it be failed to create indexer for pvb
and with the pvb information. It seems there will be an error only when the input param is not a valid k8s object
pkg/podvolume/backupper.go
Outdated
@@ -337,7 +367,8 @@ func (b *backupper) WaitAllPodVolumesProcessed(log logrus.FieldLogger) []*velero | |||
case <-b.ctx.Done(): | |||
log.Error("timed out waiting for all PodVolumeBackups to complete") | |||
case <-done: | |||
for _, pvb := range b.result { | |||
for _, obj := range b.pvbIndexer.List() { | |||
pvb := obj.(*velerov1api.PodVolumeBackup) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a risk for panic? Maybe we should be a little more defensive to log an error and continue?
pkg/podvolume/backupper.go
Outdated
if !exist { | ||
return nil, nil | ||
} | ||
return obj.(*velerov1api.PodVolumeBackup), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
risk for panic?
pkg/podvolume/backupper.go
Outdated
} | ||
var pvbs []*velerov1api.PodVolumeBackup | ||
for _, obj := range objs { | ||
pvbs = append(pvbs, obj.(*velerov1api.PodVolumeBackup)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
risk for panic?
…server to avoid API server issue Check the PVB status via podvolume Backupper rather than calling API server to avoid API server issue Fixes vmware-tanzu#8587 Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
b12df50
to
25b5c44
Compare
Check the PVB status via podvolume Backupper rather than calling API server to avoid API server issue
Fixes #8587
Thank you for contributing to Velero!
Please add a summary of your change
Does your change fix a particular issue?
Fixes #(issue)
Please indicate you've done the following:
make new-changelog
) or comment/kind changelog-not-required
on this PR.site/content/docs/main
.