Ignore not found error during patching managedFields

Ignore not found error during patching managedFields

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
pull/6110/head
Wenkai Yin(尹文开) 2023-04-11 17:42:02 +08:00
parent 7d0d56e5fa
commit 5c0c378797
2 changed files with 7 additions and 3 deletions

View File

@ -62,6 +62,7 @@ To fix CVEs and keep pace with Golang, Velero made changes as follows:
### All Changes
* Ignore not found error during patching managedFields (#6110, @ywk253100)
* Modify new scope resource filters name. (#6089, @blackpiglet)
* Make Velero not exits when EnableCSI is on and CSI snapshot not installed (#6062, @blackpiglet)
* Restore Services before Clusters (#6057, @ywk253100)

View File

@ -1514,10 +1514,13 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso
if patchBytes != nil {
if _, err = resourceClient.Patch(name, patchBytes); err != nil {
ctx.log.Errorf("error patch for managed fields %s: %v", kube.NamespaceAndName(obj), err)
errs.Add(namespace, err)
return warnings, errs, itemExists
if !apierrors.IsNotFound(err) {
errs.Add(namespace, err)
return warnings, errs, itemExists
}
} else {
ctx.log.Infof("the managed fields for %s is patched", kube.NamespaceAndName(obj))
}
ctx.log.Infof("the managed fields for %s is patched", kube.NamespaceAndName(obj))
}
if groupResource == kuberesource.Pods {