diff --git a/pkg/resourceinterpreter/customizedinterpreter/customized.go b/pkg/resourceinterpreter/customizedinterpreter/customized.go index 2b2422e95..6213cc2f7 100644 --- a/pkg/resourceinterpreter/customizedinterpreter/customized.go +++ b/pkg/resourceinterpreter/customizedinterpreter/customized.go @@ -252,6 +252,9 @@ func (e *CustomizedInterpreter) callHook(ctx context.Context, hook configmanager func applyPatch(object *unstructured.Unstructured, patch []byte, patchType configv1alpha1.PatchType) (*unstructured.Unstructured, error) { switch patchType { case configv1alpha1.PatchTypeJSONPatch: + if len(patch) == 0 { + return object, nil + } patchObj, err := jsonpatch.DecodePatch(patch) if err != nil { return nil, err diff --git a/pkg/resourceinterpreter/customizedinterpreter/webhook/resourceinterpretercontext.go b/pkg/resourceinterpreter/customizedinterpreter/webhook/resourceinterpretercontext.go index 7d984f8b9..1fc476a0a 100644 --- a/pkg/resourceinterpreter/customizedinterpreter/webhook/resourceinterpretercontext.go +++ b/pkg/resourceinterpreter/customizedinterpreter/webhook/resourceinterpretercontext.go @@ -107,7 +107,9 @@ func verifyResourceInterpreterContext(operation configv1alpha1.InterpreterOperat return nil, err } res.Patch = response.Patch - res.PatchType = *response.PatchType + if response.PatchType != nil { + res.PatchType = *response.PatchType + } return res, nil case configv1alpha1.InterpreterOperationInterpretStatus: res.RawStatus = *response.RawStatus