Log when a related resource's origin object can't be found - #183
Log when a related resource's origin object can't be found#183rose-krone wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @rose-krone. Thanks for your PR. I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
resolveRelatedResourceObjectsInNamespaces silently swallowed a NotFound when fetching a related resource's origin object, with the comment assuming it could only happen in a narrow List/Get race. It also fires permanently whenever a related resource's object.template/reference/ selector computes a name that never matches a real object - a config bug, not a race - and in that case every reconcile of the primary object hits it again, silently, while still reporting success. Threads the existing *zap.SugaredLogger through resolveRelatedResourceObjects and resolveRelatedResourceObjectsInNamespaces (both call sites already had one available: processRelatedResource's own `log` param, and confirmOriginEmpty's `s.log`) and logs the related resource's identifier plus the computed namespace/name when this happens, so a misconfigured related resource is diagnosable from the agent's own logs instead of only from its source. Signed-off-by: René Rose <rene.rose@krone.de>
9d43079 to
7210299
Compare
Summary
resolveRelatedResourceObjectsInNamespacessilently swallows aNotFoundwhen fetching arelated resource's origin object, on the assumption (per its own comment) that this can only
happen in a narrow List/Get race. It also fires permanently whenever a related resource's
object.template/reference/selectorcomputes a name that never matches a real object — aconfig bug, not a race — and in that case every reconcile of the primary object hits it again,
silently, while still reporting
success.This PR threads the
*zap.SugaredLoggerthat's already available at both call sites(
processRelatedResource's ownlogparam, andconfirmOriginEmpty'ss.log) throughresolveRelatedResourceObjects→resolveRelatedResourceObjectsInNamespaces, and logs therelated resource's
identifierplus the computed origin namespace/name when theNotFoundishit, so a misconfigured related resource is diagnosable from the agent's own logs instead of
only by reading the source.
Found while debugging a cluster-scoped,
identityHash-based related resource that never syncedin a real deployment — the actual root cause was a naming-template bug in our own config, but it
took a full day of eliminating hangs/RBAC/permission-claims/network policy to get there, purely
because nothing in the agent's logs, metrics, or events pointed at the actual cause.
What Type of PR Is This?
/kind bug
Release Notes