fix: populate involvedObject name/namespace on Finalized events for already-deleted objects - #215
Open
OsoriAndOmori wants to merge 1 commit into
Conversation
OsoriAndOmori
force-pushed
the
fix/finalized-event-missing-object-name
branch
from
August 10, 2026 02:58
393abe9 to
38cc56e
Compare
…lready-deleted objects cleanupNotFound records a "Finalized" event for each finalizer that was removed, but the object passed in was only obtained via object.New[T]() and was never populated by Get() (which returned NotFound). As a result the event's involvedObject.Name was always empty, which downstream log processors (e.g. Grafana Alloy's loki.source.kubernetes_events) reject with "no involved object for event". req.Name/req.Namespace are already known at this point, so set them on o before it's used to record the event.
OsoriAndOmori
force-pushed
the
fix/finalized-event-missing-object-name
branch
from
August 10, 2026 02:59
38cc56e to
cb25130
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
cleanupNotFoundrecords a "Finalized" event for each finalizer thatwas removed while reconciling an object that has already been deleted.
The object passed to the event recorder is only obtained via
object.New[T]()and is never populated byGet()(which returnedNotFound), so the event'sinvolvedObject.Name/Namespacewerealways empty.
req.Name/req.Namespaceare already known at this point, so thissets them on
obefore it's used to record the event.Why
Downstream log processors that key off
involvedObject(e.g. GrafanaAlloy's
loki.source.kubernetes_events) reject events with an emptyinvolved object name and log an error for every occurrence
(
err="no involved object for event"). This fires on everyfinalizer removal for an object that no longer exists — e.g. Karpenter
removing
karpenter.sh/terminationfrom a Node/NodeClaim as the lastfinalizer, which happens on every node termination.
Testing
when deletion timestamp is set" tests (both
ControllerandGenericObjectController) verifying theFinalizedevent'sinvolvedObjectcarries the correct Name/Namespace.with the fix.
go build ./...,go vet ./...,gofmt -l,go test ./...allclean.