Skip to content
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

Open
wants to merge 1 commit into
base: release-1.15
Choose a base branch
from

Conversation

ywk253100
Copy link
Contributor

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:

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 44.92754% with 38 lines in your changes missing coverage. Please review.

Project coverage is 59.10%. Comparing base (7db8761) to head (25b5c44).

Files with missing lines Patch % Lines
pkg/podvolume/backupper.go 43.63% 21 Missing and 10 partials ⚠️
pkg/backup/backup.go 41.66% 5 Missing and 2 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

Lyndon-Li
Lyndon-Li previously approved these changes Jan 10, 2025
blackpiglet
blackpiglet previously approved these changes Jan 10, 2025
pvb.Status.Phase == velerov1api.PodVolumeBackupPhaseFailed {
processed = true
}
pvbMap[pvb] = processed
Copy link
Contributor

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

@@ -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))
Copy link
Contributor

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

@@ -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)
Copy link
Contributor

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?

if !exist {
return nil, nil
}
return obj.(*velerov1api.PodVolumeBackup), nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

risk for panic?

}
var pvbs []*velerov1api.PodVolumeBackup
for _, obj := range objs {
pvbs = append(pvbs, obj.(*velerov1api.PodVolumeBackup))
Copy link
Contributor

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants