// 2. save the original and patched to detect whether there were conflicting changes on retries
// 2. save the original and patched to detect whether there were conflicting changes on retries
originalResourceVersion=currentResourceVersion
objToUpdate:=patcher.New()
objToUpdate:=patcher.New()
// For performance reasons, in case of strategicpatch, we avoid json
// For performance reasons, in case of strategicpatch, we avoid json
...
@@ -690,11 +697,12 @@ func patchResource(
...
@@ -690,11 +697,12 @@ func patchResource(
iferr!=nil{
iferr!=nil{
returnnil,err
returnnil,err
}
}
ifhasConflicts{
ifhasConflicts{
diff1,_:=json.Marshal(currentPatchMap)
diff1,_:=json.Marshal(currentPatchMap)
diff2,_:=json.Marshal(originalPatchMap)
diff2,_:=json.Marshal(originalPatchMap)
patchDiffErr:=fmt.Errorf("there is a meaningful conflict:\n diff1=%v\n, diff2=%v\n",diff1,diff2)
patchDiffErr:=fmt.Errorf("there is a meaningful conflict (firstResourceVersion: %q, currentResourceVersion: %q):\n diff1=%v\n, diff2=%v\n",originalResourceVersion,currentResourceVersion,string(diff1),string(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)
glog.V(4).Infof("patchResource failed for resource %s, because there is a meaningful conflict(firstResourceVersion: %q, currentResourceVersion: %q):\n diff1=%v\n, diff2=%v\n",name,originalResourceVersion,currentResourceVersion,string(diff1),string(diff2))
// Return the last conflict error we got if we have one
// Return the last conflict error we got if we have one