From ea8669661aa9f376e1a08ee77f65aa6ca452ed49 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Thu, 17 Mar 2016 16:19:05 -0400 Subject: [PATCH] Use versioned object when computing patch --- pkg/apiserver/resthandler.go | 4 ++-- pkg/apiserver/resthandler_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/apiserver/resthandler.go b/pkg/apiserver/resthandler.go index fd24f1f822af7..6f615b3f1c2ba 100644 --- a/pkg/apiserver/resthandler.go +++ b/pkg/apiserver/resthandler.go @@ -567,11 +567,11 @@ func patchResource(ctx api.Context, admit updateAdmissionFunc, timeout time.Dura return nil, err } - currentPatch, err := strategicpatch.CreateStrategicMergePatch(originalObjJS, currentObjectJS, patcher.New()) + currentPatch, err := strategicpatch.CreateStrategicMergePatch(originalObjJS, currentObjectJS, versionedObj) if err != nil { return nil, err } - originalPatch, err := strategicpatch.CreateStrategicMergePatch(originalObjJS, originalPatchedObjJS, patcher.New()) + originalPatch, err := strategicpatch.CreateStrategicMergePatch(originalObjJS, originalPatchedObjJS, versionedObj) if err != nil { return nil, err } diff --git a/pkg/apiserver/resthandler_test.go b/pkg/apiserver/resthandler_test.go index 0a8849f7e2939..c0ad951eab09b 100644 --- a/pkg/apiserver/resthandler_test.go +++ b/pkg/apiserver/resthandler_test.go @@ -204,7 +204,7 @@ func (tc *patchTestCase) Run(t *testing.T) { continue case api.StrategicMergePatchType: - patch, err = strategicpatch.CreateStrategicMergePatch(originalObjJS, changedJS, &api.Pod{}) + patch, err = strategicpatch.CreateStrategicMergePatch(originalObjJS, changedJS, versionedObj) if err != nil { t.Errorf("%s: unexpected error: %v", tc.name, err) return