Skip to content
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

resolver: cleanup of deprecated grpc resolver target.Endpoint field #14922

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

ramil600
Copy link
Contributor

grpc.resolver.Target.Endpoint and some other fields are deprecated, URL field is suggested to use instead.
URL.Path is required to be stripped of "/" prefix for naming/resolver to work properly

Signed-off-by: Ramil Mirhasanov [email protected]

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2022

Codecov Report

Merging #14922 (932cb95) into main (142fa76) will decrease coverage by 0.24%.
The diff coverage is 60.00%.

@@            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     
Flag Coverage Δ
all 74.49% <60.00%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
client/v3/naming/resolver/resolver.go 83.01% <60.00%> (-2.70%) ⬇️
server/etcdserver/api/v3rpc/util.go 51.61% <0.00%> (-29.04%) ⬇️
client/v3/leasing/util.go 91.66% <0.00%> (-6.67%) ⬇️
client/v3/namespace/watch.go 87.87% <0.00%> (-6.07%) ⬇️
server/storage/mvcc/watchable_store.go 85.14% <0.00%> (-5.44%) ⬇️
client/pkg/v3/testutil/leak.go 62.83% <0.00%> (-4.43%) ⬇️
server/proxy/grpcproxy/watch.go 92.48% <0.00%> (-4.05%) ⬇️
client/v3/leasing/txn.go 88.09% <0.00%> (-3.18%) ⬇️
server/etcdserver/api/v3rpc/auth.go 79.34% <0.00%> (-2.18%) ⬇️
server/etcdserver/metrics.go 80.85% <0.00%> (-2.13%) ⬇️
... and 11 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -33,7 +34,7 @@ type builder struct {
func (b builder) Build(target gresolver.Target, cc gresolver.ClientConn, opts gresolver.BuildOptions) (gresolver.Resolver, error) {
r := &resolver{
c: b.c,
target: target.Endpoint,
target: strings.TrimPrefix(target.URL.Path, "/"),
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@ahrtr ahrtr Dec 11, 2022

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, "/")

Copy link
Contributor Author

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.

Copy link
Member

@fuweid fuweid left a 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.

@ramil600 ramil600 requested review from ahrtr and fuweid and removed request for ahrtr and fuweid December 12, 2022 10:11
@@ -31,9 +32,14 @@ type builder struct {
}

func (b builder) Build(target gresolver.Target, cc gresolver.ClientConn, opts gresolver.BuildOptions) (gresolver.Resolver, error) {
endpoint := target.URL.Path
Copy link
Member

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

Copy link
Contributor Author

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]>
Copy link
Member

@ahrtr ahrtr left a 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

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM(non-binding)

@ahrtr ahrtr merged commit d11cc9e into etcd-io:main Dec 13, 2022
chaochn47 added a commit to chaochn47/etcd that referenced this pull request Oct 17, 2023
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]>
dusk125 pushed a commit to dusk125/etcd that referenced this pull request Oct 18, 2023
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]>
dusk125 pushed a commit to dusk125/etcd that referenced this pull request Oct 18, 2023
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants