mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
add details to patch conflict
This commit is contained in:
parent
914402281b
commit
8a61368a60
@ -663,17 +663,17 @@ func patchResource(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if hasConflicts {
|
if hasConflicts {
|
||||||
if glog.V(4) {
|
|
||||||
diff1, _ := json.Marshal(currentPatchMap)
|
diff1, _ := json.Marshal(currentPatchMap)
|
||||||
diff2, _ := json.Marshal(originalPatchMap)
|
diff2, _ := json.Marshal(originalPatchMap)
|
||||||
glog.Infof("patchResource failed for resource %s, because there is a meaningful conflict.\n diff1=%v\n, diff2=%v\n", name, diff1, diff2)
|
patchDiffErr := fmt.Errorf("there is a meaningful conflict:\n diff1=%v\n, diff2=%v\n", diff1, diff2)
|
||||||
}
|
glog.V(4).Infof("patchResource failed for resource %s, because there is a meaningful conflict.\n diff1=%v\n, diff2=%v\n", name, diff1, diff2)
|
||||||
|
|
||||||
// Return the last conflict error we got if we have one
|
// Return the last conflict error we got if we have one
|
||||||
if lastConflictErr != nil {
|
if lastConflictErr != nil {
|
||||||
return nil, lastConflictErr
|
return nil, lastConflictErr
|
||||||
}
|
}
|
||||||
// Otherwise manufacture one of our own
|
// Otherwise manufacture one of our own
|
||||||
return nil, errors.NewConflict(resource.GroupResource(), name, nil)
|
return nil, errors.NewConflict(resource.GroupResource(), name, patchDiffErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
objToUpdate := patcher.New()
|
objToUpdate := patcher.New()
|
||||||
|
Loading…
Reference in New Issue
Block a user