-
Notifications
You must be signed in to change notification settings - Fork 4.6k
xdsclient: preserve original bytes for decoding when the resource is wrapped #8411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8411 +/- ##
==========================================
- Coverage 82.51% 82.30% -0.22%
==========================================
Files 414 414
Lines 40420 40424 +4
==========================================
- Hits 33354 33271 -83
- Misses 5719 5787 +68
- Partials 1347 1366 +19
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. From my reading of the code, all the existing decoders are calling xdsresource.UnwrapResource on the passed anypb.Any. All of them should continue to work the same even if the wrapped resource is passed after this change.
Yes. Earlier, we used to pass the resource as-is to the decoders and let them call |
| topLevelErrors = append(topLevelErrors, xdsresource.NewErrorf(xdsresource.ErrorTypeResourceTypeUnsupported, "unexpected resource type: %q ", inner.GetTypeUrl())) | ||
| continue | ||
| } | ||
| result, err := rType.Decoder.Decode(r.GetValue(), *opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if r is wrapped and xdsresource.UnwrapResource() returns inner resource, will r.GetValue() return the same resource as inner.Resource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. In that case r.GetValue will return the wrapped resource and the decoder will have to unwrap it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they will not be the same. r.GetValue() will return a serialized anypb.Any that contains a v3discoverypb.Resource{} while inner.Resource.GetValue() will return a serialized anypb.Any that contains the unwrapped xDS resouce proto.
This doesn't effect the decoders because they call UnwrapResource on the anypb.Any that they are passed to undo any wrapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah as long as decoders are doing that. Our 4 types do it.
* xdsclient: preserve original bytes for decoding when the resource is wrapped (#8411) * xds: Avoid error logs when setting fallback bootstrap config (#8419) * xdsclient: relay marshalled bytes of complete resource proto to decoders (#8422) * xds: give up pool lock before closing xdsclient channel (#8445) * transport: release mutex before returning on expired deadlines in server streams (#8451) --------- Co-authored-by: Easwar Swaminathan <easwars@google.com> Co-authored-by: Arjan Singh Bal <46515553+arjan-bal@users.noreply.github.com> Co-authored-by: Purnesh Dixit <purneshdixit@google.com> Co-authored-by: Doug Fawley <dfawley@google.com>
Some resource types do not have a
namefield in them. They rely on being wrapped in adiscovery.Resourceproto to give them a name. So when the xdsClient unwraps such a resource for validation purposes, it still needs to send the wrapped message bytes to the decoder.RELEASE NOTES: none