mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-04 04:04:02 +00:00
Parse resource from backup tarball directly rather than resolving it via discovery service to avoid #4009 (#4398)
This commit is contained in:
1
changelogs/unreleased/4398-ywk253100
Normal file
1
changelogs/unreleased/4398-ywk253100
Normal file
@@ -0,0 +1 @@
|
||||
Fix the issue that the backup cannot be deleted after the application uninstalled
|
||||
@@ -74,15 +74,8 @@ func InvokeDeleteActions(ctx *Context) error {
|
||||
|
||||
processdResources := sets.NewString()
|
||||
|
||||
ctx.Log.Debugf("Trying to reconcile resource names with Kube API server.")
|
||||
// Transform resource names based on what's canonical in the API server.
|
||||
for resource := range backupResources {
|
||||
gvr, _, err := ctx.DiscoveryHelper.ResourceFor(schema.ParseGroupResource(resource).WithVersion(""))
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to resolve resource into complete group/version/resource: %v", resource)
|
||||
}
|
||||
|
||||
groupResource := gvr.GroupResource()
|
||||
groupResource := schema.ParseGroupResource(resource)
|
||||
|
||||
// We've already seen this group/resource, so don't process it again.
|
||||
if processdResources.Has(groupResource.String()) {
|
||||
@@ -92,8 +85,6 @@ func InvokeDeleteActions(ctx *Context) error {
|
||||
// Get a list of all items that exist for this resource
|
||||
resourceList := backupResources[groupResource.String()]
|
||||
if resourceList == nil {
|
||||
// After canonicalization from the API server, the resources may not exist in the tarball
|
||||
// Skip them if that's the case.
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user