Skip to content

Fix ListBackups to skip directories without metadata file#9511

Open
mpryc wants to merge 1 commit intovmware-tanzu:mainfrom
mpryc:fix_8466
Open

Fix ListBackups to skip directories without metadata file#9511
mpryc wants to merge 1 commit intovmware-tanzu:mainfrom
mpryc:fix_8466

Conversation

@mpryc
Copy link
Contributor

@mpryc mpryc commented Jan 30, 2026

When using object stores with suspended versioning (e.g., MinIO), deleted backup folders persist as empty directories. The S3 API returns these directories, but they lack the velero-backup.json metadata file.

This change adds a check in ListBackups() to verify that the backup metadata file exists before including a backup in the results. Empty directories without metadata are now logged at debug level and skipped.

Suggested-by: @chrisamti

Fixes #8466

Please indicate you've done the following:

When using object stores with suspended versioning (e.g., MinIO),
deleted backup folders persist as empty directories. The S3 API
returns these directories, but they lack the velero-backup.json
metadata file.

This change adds a check in ListBackups() to verify that the backup
metadata file exists before including a backup in the results. Empty
directories without metadata are now logged at debug level and skipped.

Fixes: vmware-tanzu#8466

Suggested-by: chrisamti <https://github.com/chrisamti>
Signed-off-by: Michal Pryc <mpryc@redhat.com>
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@2376b69). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/persistence/object_store.go 42.85% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9511   +/-   ##
=======================================
  Coverage        ?   60.53%           
=======================================
  Files           ?      386           
  Lines           ?    36378           
  Branches        ?        0           
=======================================
  Hits            ?    22023           
  Misses          ?    12773           
  Partials        ?     1582           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ywk253100 ywk253100 requested a review from blackpiglet February 2, 2026 06:42
@blackpiglet
Copy link
Contributor

What did you expect to happen:

Velero should either work with versioned s3 buckets or not pickup the metadata from the versioned blobs if a file was deleted (ex:mc works correctly with versions and does not list any deleted file that has "active" versions)

From the issue's description, I think Velero can read the velero-backup.json of the backup even if the backup is deleted.

I'm still checking with the issue reporter to make sure that.

If that is true, then the current fix cannot address the original issue.

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.

Velero doesnt do well with Minio bucket versioning

3 participants