Skip to content

Commit

Permalink
Merge pull request #7055 from kaovilai/warnOnCreateAlreadyExistsGetEr…
Browse files Browse the repository at this point in the history
…ror-release-1.11

release-1.11: restore: Use warning when Create IsAlreadyExist and Get error (#7004)
  • Loading branch information
ywk253100 authored Nov 3, 2023
2 parents c6ec8f2 + d7dd050 commit 8f9e937
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/7055-kaovilai
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
restore: Use warning when Create IsAlreadyExist and Get error
4 changes: 2 additions & 2 deletions pkg/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -1357,8 +1357,8 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso
// otherwise, we will return the original creation error.
fromCluster, err = resourceClient.Get(name, metav1.GetOptions{})
if err != nil && isAlreadyExistsError {
ctx.log.Errorf("Error retrieving in-cluster version of %s: %v", kube.NamespaceAndName(obj), err)
errs.Add(namespace, err)
ctx.log.Warnf("Unable to retrieve in-cluster version of %s: %v, object won't be restored by velero or have restore labels, and existing resource policy is not applied", kube.NamespaceAndName(obj), err)
warnings.Add(namespace, err)
return warnings, errs, itemExists
}
}
Expand Down

0 comments on commit 8f9e937

Please sign in to comment.