Skip to content

Commit c261173

Browse files
authored
Merge pull request #7345 from killianmuldoon/logs/fix-patch-uid-conditions
🐛 Remove unique patch ID from TopologyReconcile conditions
2 parents da99b25 + 0098956 commit c261173

File tree

1 file changed

+10
-9
lines changed
  • internal/controllers/topology/cluster/patches

1 file changed

+10
-9
lines changed

internal/controllers/topology/cluster/patches/engine.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ func applyPatchesToRequest(ctx context.Context, req *runtimehooksv1.GeneratePatc
290290

291291
// If a patch doesn't have a corresponding request item, the patch is invalid.
292292
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")
294295
}
295296

296297
// Use the patch to create a patched copy of the template.
@@ -302,29 +303,29 @@ func applyPatchesToRequest(ctx context.Context, req *runtimehooksv1.GeneratePatc
302303
log.V(5).Infof("Accumulating JSON patch: %s", string(patch.Patch))
303304
jsonPatch, err := jsonpatch.DecodePatch(patch.Patch)
304305
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)")
307308
}
308309

309310
patchedTemplate, err = jsonPatch.Apply(requestItem.Object.Raw)
310311
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)")
313314
}
314315
case runtimehooksv1.JSONMergePatchType:
315316
log.V(5).Infof("Accumulating JSON merge patch: %s", string(patch.Patch))
316317
patchedTemplate, err = jsonpatch.MergePatch(requestItem.Object.Raw, patch.Patch)
317318
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)")
320321
}
321322
}
322323

323324
// Overwrite the spec of template.Template with the spec of the patchedTemplate,
324325
// to ensure that we only pick up changes to the spec.
325326
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")
328329
}
329330
}
330331
return nil

0 commit comments

Comments
 (0)