@@ -290,7 +290,8 @@ func applyPatchesToRequest(ctx context.Context, req *runtimehooksv1.GeneratePatc
290
290
291
291
// If a patch doesn't have a corresponding request item, the patch is invalid.
292
292
if requestItem == nil {
293
- return errors .Errorf ("unable to find corresponding request item with uid %q for the patch" , patch .UID )
293
+ log .Infof ("Unable to find corresponding request item with uid %q for the patch" , patch .UID )
294
+ return errors .Errorf ("unable to find corresponding request item for patch" )
294
295
}
295
296
296
297
// Use the patch to create a patched copy of the template.
@@ -302,29 +303,29 @@ func applyPatchesToRequest(ctx context.Context, req *runtimehooksv1.GeneratePatc
302
303
log .V (5 ).Infof ("Accumulating JSON patch: %s" , string (patch .Patch ))
303
304
jsonPatch , err := jsonpatch .DecodePatch (patch .Patch )
304
305
if err != nil {
305
- return errors . Wrapf ( err , "failed to apply patch with uid %q: error decoding json patch (RFC6902): %s" ,
306
- requestItem . UID , string ( patch . Patch ) )
306
+ log . Infof ( "Failed to apply patch with uid %q: error decoding json patch (RFC6902): %s: %s" , requestItem . UID , string ( patch . Patch ), err )
307
+ return errors . Wrap ( err , "failed to apply patch: error decoding json patch (RFC6902)" )
307
308
}
308
309
309
310
patchedTemplate , err = jsonPatch .Apply (requestItem .Object .Raw )
310
311
if err != nil {
311
- return errors . Wrapf ( err , "failed to apply patch with uid %q: error applying json patch (RFC6902): %s" ,
312
- requestItem . UID , string ( patch . Patch ) )
312
+ log . Infof ( "Failed to apply patch with uid %q: error applying json patch (RFC6902): %s: %s" , requestItem . UID , string ( patch . Patch ), err )
313
+ return errors . Wrap ( err , "failed to apply patch: error applying json patch (RFC6902)" )
313
314
}
314
315
case runtimehooksv1 .JSONMergePatchType :
315
316
log .V (5 ).Infof ("Accumulating JSON merge patch: %s" , string (patch .Patch ))
316
317
patchedTemplate , err = jsonpatch .MergePatch (requestItem .Object .Raw , patch .Patch )
317
318
if err != nil {
318
- return errors . Wrapf ( err , "failed to apply patch with uid %q: error applying json merge patch (RFC7386): %s" ,
319
- requestItem . UID , string ( patch . Patch ) )
319
+ log . Infof ( "Failed to apply patch with uid %q: error applying json merge patch (RFC7386): %s: %s" , requestItem . UID , string ( patch . Patch ), err )
320
+ return errors . Wrap ( err , "failed to apply patch: error applying json merge patch (RFC7386)" )
320
321
}
321
322
}
322
323
323
324
// Overwrite the spec of template.Template with the spec of the patchedTemplate,
324
325
// to ensure that we only pick up changes to the spec.
325
326
if err := patchTemplateSpec (& requestItem .Object , patchedTemplate ); err != nil {
326
- return errors . Wrapf ( err , "failed to apply patch to template %s" ,
327
- requestItem . UID )
327
+ log . Infof ( "Failed to apply patch to template %s: %s" , requestItem . UID , err )
328
+ return errors . Wrap ( err , "failed to apply patch to template" )
328
329
}
329
330
}
330
331
return nil
0 commit comments