-
Notifications
You must be signed in to change notification settings - Fork 10.2k
resolver: cleanup of deprecated grpc resolver target.Endpoint field #14922
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 Report
@@ Coverage Diff @@
## main #14922 +/- ##
==========================================
- Coverage 74.73% 74.49% -0.25%
==========================================
Files 415 415
Lines 34338 34342 +4
==========================================
- Hits 25664 25583 -81
- Misses 7037 7111 +74
- Partials 1637 1648 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
| r := &resolver{ | ||
| c: b.c, | ||
| target: target.Endpoint, | ||
| target: strings.TrimPrefix(target.URL.Path, "/"), |
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.
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.
The comment says Deprecated: use URL.Path or URL.Opaque instead.. Should we consider the URL.Opaque as well? Shouldn't the logic something like below?
prefix := target.URL.Path
if prefix == "" {
prefix = target.URL.Opaque
}
prefix = strings.TrimPrefix(prefix, "/")
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.
Hi @ahrtr,
Done.
I looked into your query: indeed if we declare URL with no '/' after the scheme, endpoint can be written to URL.Opaque.
fuweid
left a comment
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(non-binding)
TestEtcdGrpcResolver already test it.
474e8b0 to
db2fd0f
Compare
| } | ||
|
|
||
| func (b builder) Build(target gresolver.Target, cc gresolver.ClientConn, opts gresolver.BuildOptions) (gresolver.Resolver, error) { | ||
| endpoint := target.URL.Path |
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.
Could you add a comment above line 35 something like below?
Refer to https://github.com/grpc/grpc-go/blob/16d3df80f029f57cff5458f1d6da6aedbc23545d/clientconn.go#L1587-L1611
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.
Done, thank you for the review.
target.Endpoint and some other fields are deprecated, URL field is suggested to use instead path is required to be stripped of "/" prefix for naming/resolver to work porperly Signed-off-by: Ramil Mirhasanov <[email protected]>
db2fd0f to
932cb95
Compare
ahrtr
left a comment
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
Thank you @ramil600
fuweid
left a comment
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(non-binding)
The last step with gRPC update behavior changes auditing to resolve CVE etcd-io#16740 in 3.5 This PR backports etcd-io#14922, etcd-io#16338, etcd-io#16587, etcd-io#16630, etcd-io#16636 and etcd-io#16739 to release-3.5. Signed-off-by: Chao Chen <[email protected]>
The last step with gRPC update behavior changes auditing to resolve CVE etcd-io#16740 in 3.5 This PR backports etcd-io#14922, etcd-io#16338, etcd-io#16587, etcd-io#16630, etcd-io#16636 and etcd-io#16739 to release-3.5. Signed-off-by: Chao Chen <[email protected]>
The last step with gRPC update behavior changes auditing to resolve CVE etcd-io#16740 in 3.5 This PR backports etcd-io#14922, etcd-io#16338, etcd-io#16587, etcd-io#16630, etcd-io#16636 and etcd-io#16739 to release-3.5. Signed-off-by: Chao Chen <[email protected]>
grpc.resolver.Target.Endpointand some other fields are deprecated, URL field is suggested to use instead.URL.Pathis required to be stripped of "/" prefix for naming/resolver to work properlySigned-off-by: Ramil Mirhasanov [email protected]
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.