Skip to content

Conversation

@radiohead
Copy link
Contributor

What

This commit fixes the handling of objects in the decoder by properly dispatching watch & status types.

Why

Those types were not handled properly before, causing WatchList to sometimes fail, if watch encountered retryable errors.

What:

This commit fixes the handling of objects in the decoder by properly
dispatching watch & status types.

Why:

Those types were not handled properly before, causing WatchList to
sometimes fail, if watch encountered retryable errors.

Signed-off-by: Igor Suleymanov <[email protected]>
@radiohead radiohead requested a review from a team as a code owner October 28, 2025 18:09
@radiohead radiohead requested review from IfSentient, MissingRoberto and spinillos and removed request for MissingRoberto October 28, 2025 18:09

switch {
case chk.Type != "": // Watch
obj, ok := into.(*metav1.WatchEvent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If into is nil here, should we instead set into into a *metav1.WatchEvent? In the CodecDecoder we have the into type checks if into is non-nil, and then fallback handling for a nil into (checking defaults, then trying the check unmarshal and examining that).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@radiohead radiohead requested a review from IfSentient October 29, 2025 11:06
@radiohead radiohead force-pushed the fix/watch-status-errors branch from 0f9c173 to 18aca36 Compare October 29, 2025 14:11
Copy link
Contributor

@IfSentient IfSentient left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing that I missed before

k8s/wrappers.go Outdated
return codec.Read(bytes.NewReader(o.object), into)
}

// UntypedListObjectWrapper wraps a list of UntypedObjectWrappers, and implements runtime.Object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This godoc seems incorrect, given that items is a json.RawMessage. Does UntypedListObjectWrapper need to allow for access to the items by the reflector, or does it get iterated over by internal machinery to get those? IIRC for the informer to process a list, it needs to have an exported Items field which is a slice of objects.

@radiohead radiohead merged commit 9e2a727 into main Oct 29, 2025
15 checks passed
@radiohead radiohead deleted the fix/watch-status-errors branch October 29, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants