Merge branch 'vmware-tanzu:release-1.10' into release-1.10

This commit is contained in:
Xun Jiang/Bruce Jiang
2023-04-13 09:53:11 +08:00
committed by GitHub
4 changed files with 9 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
Fix issue #5972, don't assume errorField as error type when dealing with logger.WithError
+1
View File
@@ -0,0 +1 @@
Ignore not found error during patching managedFields
+6 -3
View File
@@ -1434,10 +1434,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
if !apierrors.IsNotFound(err) {
errs.Add(namespace, err)
return warnings, errs
}
} 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 {
+1 -1
View File
@@ -71,7 +71,7 @@ func (h *LogHook) Fire(entry *logrus.Entry) error {
entryMessage = fmt.Sprintf("%s name: /%s", entryMessage, nameField.(string))
}
if isErrorFieldPresent {
entryMessage = fmt.Sprintf("%s error: /%s", entryMessage, errorField.(error).Error())
entryMessage = fmt.Sprintf("%s error: /%v", entryMessage, errorField)
}
if isNamespacePresent {