Fix informer delete handling#2039
Open
27rohan wants to merge 1 commit into
Open
Conversation
Decode direct objects and DeletedFinalStateUnknown tombstones through one typed delete handler, reporting malformed events instead of panicking. Signed-off-by: Rohan Thakkar <rohant@twitter.com>
27rohan
force-pushed
the
fix/informer-delete-handling
branch
from
July 17, 2026 19:55
d6a290d to
320703a
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.
Summary
When Kubernetes tells the operator that something was deleted, the notification sometimes arrives in an unexpected wrapper format. The operator's code didn't handle that case and would crash.
This PR teaches the code to unwrap both formats safely — and if the notification is garbage, it just logs an error instead of crashing. Tests were added to cover all these cases.
Why this is needed
client-go may wrap a deleted object in
DeletedFinalStateUnknownwhen a watch deletion is missed and a subsequent relist discovers that the cached object is gone. The existing handlers use bare type assertions, so receiving this valid client-go payload panics the operator.This exact failure has occurred in released versions of the upstream operator:
DeletedFinalStateUnknownin 0.23.5.This PR only makes existing delete callbacks safe. It does not enable the dormant CHI
ReconcileDeletequeue path or otherwise change deletion policy.Fix
Routes both direct objects and
DeletedFinalStateUnknowntombstones through a single typed delete handler in the CHI controller's informer callbacks, so malformed delete events are reported instead of causing panics. Includes regression tests for direct, tombstone, malformed, and nil payloads.DeletedFinalStateUnknowntombstones through one typed delete handler, reporting malformed events instead of panickingTest plan
go build -mod=readonly ./...go test -mod=readonly -race -count=1 -vet=off ./pkg/controller/chi/...