vmware-tanzu / velero

Backup and migrate Kubernetes applications and their persistent volumes
https://velero.io
Apache License 2.0
8.41k stars 1.37k forks source link

Unavailable BSL is still functional for backup / restore #7785

Open danfengliu opened 1 month ago

danfengliu commented 1 month ago

What steps did you take and what happened: A GCP bucket BSL is Unavailable, but backup / restore is still functional well. The reason is I had a top-level directory named dir-1.

Spec:
  Default:  true
  Object Storage:
    Bucket:  test-1
  Provider:  gcp
Status:
  Last Synced Time:      2024-05-09T08:28:24Z
  Last Validation Time:  2024-05-09T08:27:44Z
  Message:               BackupStorageLocation "default" is unavailable: Backup store contains invalid top-level directories: [dir-1]
  Phase:                 Unavailable

What did you expect to happen: Since other top-level directories do not effect backup/restore, why check that?

The following information will help us better understand what's going on:

If you are using velero v1.7.0+:
Please use velero debug --backup <backupname> --restore <restorename> to generate the support bundle, and attach to this issue, more options please refer to velero debug --help

If you are using earlier versions:
Please provide the output of the following commands (Pasting long output into a GitHub gist or other pastebin is fine.)

Anything else you would like to add:

Environment:

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.

blackpiglet commented 1 month ago

Two points need discussion in this issue. https://github.com/vmware-tanzu/velero/blob/7563a453fb962382c7b1c456ddb2a6645cdd9493/pkg/persistence/object_store_layout.go#L32-L50

blackpiglet commented 1 month ago

The agreement of the Velero team is making the Unavailable BSL stop from taking backup and restore.

vitalii-buchyn-exa commented 1 month ago

Hello community,

Experiencing the same issue.

What if I want to use a bucket for another backups? Can I configure Velero to ignore unknown top level directories? Or maybe specify an ignore list?

Thank you.

blackpiglet commented 1 month ago

Sure. You can create a new BSL for the backup. You can ignore the top-level directory by specifying a sub-prefix for the BSL. https://github.com/vmware-tanzu/velero/blob/a8d77eae959e17138845d81997291b6cf43a514d/pkg/apis/velero/v1/backupstoragelocation_types.go#L139-L151