-
Notifications
You must be signed in to change notification settings - Fork 485
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
Remove usage of deprecated grpc-go methods #5725
Open
rturner3
wants to merge
8
commits into
spiffe:main
Choose a base branch
from
rturner3:remove-usage-of-deprecated-grpc-methods
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Remove usage of deprecated grpc-go methods #5725
rturner3
wants to merge
8
commits into
spiffe:main
from
rturner3:remove-usage-of-deprecated-grpc-methods
Conversation
This file contains 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
Replace usage of deprecated `grpc.Dial()`/`grpc.DialContext()` methods with `grpc.NewClient()`. Also remove usage of `grpc.WithBlock()`, `grpc.FailOnNonTempDialError()`, and `grpc.WithReturnConnectionError()` options. The combination of these changes results in a couple behavioral changes when setting up gRPC clients: 1. gRPC will no longer dial when creating the client. Instead, it will wait until the client is used for the first time with an RPC invocation. 2. gRPC uses the DNS resolver by default when building the `*grpc.ClientConn` using `grpc.NewClient()`, whereas previously it used to resolve addresses the `passthrough` resolver by default. The result of this change in behavior is that for any invocations of `grpc.Dial()`/`grpc.DialContext()` that did not specify a URI scheme, gRPC now implicitly tries to resolve the address passed to `grpc.NewClient()` using DNS. This breaks some assumptions in the code. The workaround to preserve the previous address resolution behavior is to prepend addresses with no scheme defined with the resolver URI scheme `passthrough:`. Also refactored some test-related code in `cmd/spire-server/cli/common` into a new `test/clitest` package, since it is not intended for use in production code. Fixes spiffe#5152. Signed-off-by: Ryan Turner <[email protected]>
rturner3
requested review from
evan2645,
amartinezfayo,
azdagron and
MarcosDY
as code owners
December 17, 2024 05:32
Signed-off-by: Ryan Turner <[email protected]>
Signed-off-by: Ryan Turner <[email protected]>
Signed-off-by: Ryan Turner <[email protected]>
Signed-off-by: Ryan Turner <[email protected]>
Signed-off-by: Ryan Turner <[email protected]>
Signed-off-by: Ryan Turner <[email protected]>
Signed-off-by: Ryan Turner <[email protected]>
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.
Replace usage of deprecated
grpc.Dial()
/grpc.DialContext()
methods withgrpc.NewClient()
. Also remove usage ofgrpc.WithBlock()
,grpc.FailOnNonTempDialError()
, andgrpc.WithReturnConnectionError()
options.The combination of these changes results in a couple behavioral changes when setting up gRPC clients:
gRPC will no longer dial when creating the client. Instead, it will wait until the client is used for the first time with an RPC invocation.
gRPC uses the DNS resolver by default when building the
*grpc.ClientConn
usinggrpc.NewClient()
, whereas previously it used to resolve addresses thepassthrough
resolver by default. The result of this change in behavior is that for any invocations ofgrpc.Dial()
/grpc.DialContext()
that did not specify a URI scheme, gRPC now implicitly tries to resolve the address passed togrpc.NewClient()
using DNS. This breaks some assumptions in the code. The workaround to preserve the previous address resolution behavior is to prepend addresses with no scheme defined with the resolver URI schemepassthrough:
.Also refactored some test-related code in
cmd/spire-server/cli/common
into a newtest/clitest
package, since it is not intended for use in production code.Fixes #5152.