-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
internal/resolver: introduce a new delegating resolver to handle both target URI and proxy address resolution #7857
Merged
Merged
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
bccef6b
delegating resolver
eshitachandwani 6b89e0d
correct comments
eshitachandwani 7c2fb21
correct comments
eshitachandwani e8bb6bc
use env from envconfig
eshitachandwani 36d0573
use env from envconfig
eshitachandwani 5a87284
improve comment and var
eshitachandwani e05a895
add comment
eshitachandwani e724a9a
add newaddress function
eshitachandwani 975e235
add target resolution option and test
eshitachandwani 4b8ade9
correct NewAddress function
eshitachandwani 4ba3578
improve style and comments
eshitachandwani fa55e5b
change variable name
eshitachandwani df11d7c
change variable name
eshitachandwani 8bcf2b6
test example
eshitachandwani a5aeb9a
revert commit
eshitachandwani 47e7936
cleanup test and address comments
eshitachandwani a2e1415
address comments
eshitachandwani df87a68
address comments
eshitachandwani ed3d577
add comment
eshitachandwani dd5bdb3
add comment
eshitachandwani d24ec8b
address comments
eshitachandwani 74c6cd0
address comments
eshitachandwani 31d8c2c
address comments
eshitachandwani 1643768
mae unexported key
eshitachandwani 4a5ab5b
add backoff
eshitachandwani fd061c7
add backoff
eshitachandwani c6dbcbc
Revert "add backoff"
eshitachandwani 2be9db3
revert backoff
eshitachandwani 67e3799
add attributes package
eshitachandwani f5e1d37
correct atrributes
eshitachandwani 019f621
address comments
eshitachandwani 8348b1f
change tests
eshitachandwani f0d5b7b
correct comment
eshitachandwani 4ac31f9
improve code
eshitachandwani ed413f6
improve code
eshitachandwani 402316c
add endpt support
eshitachandwani dea9ddd
improve
eshitachandwani 40f1035
add comment
eshitachandwani 95d98b9
Merge branch 'grpc:master' into delegating_pr
eshitachandwani d5f4d8f
address comments
eshitachandwani e743cbf
add endpnt support
eshitachandwani e008feb
improve endpt
eshitachandwani 4aea07d
add test for endpoints
eshitachandwani ed345a1
add test for endpoints
eshitachandwani 7f416b0
condition and comment for endpoint
eshitachandwani e68d5de
remove condition
eshitachandwani 8848105
refactors
eshitachandwani 61edca1
correct
eshitachandwani a01cc7a
change endpoint support
eshitachandwani 845680d
correct endpoint behvaiour for DNS
eshitachandwani c752bd8
correct endpoint behvaiour for DNS
eshitachandwani d53100c
address comments
eshitachandwani 99292ea
improve
eshitachandwani 74b3cf6
improve
eshitachandwani c745144
improve
eshitachandwani 628a2a4
test for addresses
eshitachandwani eeae936
correct var names
eshitachandwani bc0adeb
rerun test
eshitachandwani 9c2ce28
address comments
eshitachandwani 4482e51
address comments
eshitachandwani 2bafe77
improve comment
eshitachandwani a0a2e50
address comments
eshitachandwani ca2cc24
remove internal
eshitachandwani 1f1e7f5
add no op res
eshitachandwani 402badf
comments
eshitachandwani 163ad20
improve
eshitachandwani db8b92c
Merge branch 'grpc:master' into delegating_pr
eshitachandwani 6623eb5
Merge branch 'grpc:master' into delegating_pr
eshitachandwani c4bde98
address comments
eshitachandwani 1c4b416
change target resolver state to pointer
eshitachandwani 5dc893c
tests
eshitachandwani 69253c7
pointer
eshitachandwani c5f8d6f
address comments
eshitachandwani bbea8c4
formatting
eshitachandwani fc2c41f
address comments
eshitachandwani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,12 +188,6 @@ func (r *delegatingResolver) updateClientConnStateLocked() error { | |
return nil | ||
} | ||
|
||
// Update curState to include target resolver's state information, such as | ||
// the service config, provided by the target resolver. This ensures | ||
// curState contains all necessary information when passed to UpdateState. | ||
// The state update is only sent after both the target and proxy resolvers | ||
// have sent their updates, and curState has been updated with the combined | ||
// addresses. | ||
curState := *r.targetResolverState | ||
// If multiple resolved proxy addresses are present, we send only the | ||
// unresolved proxy host and let net.Dial handle the proxy host name | ||
|
@@ -242,6 +236,7 @@ func (r *delegatingResolver) updateClientConnStateLocked() error { | |
} | ||
endpoints = append(endpoints, resolver.Endpoint{Addresses: addrs}) | ||
} | ||
// Use the targetResolverState for its service config and attributes contents. | ||
curState.Addresses = addresses | ||
curState.Endpoints = endpoints | ||
return r.cc.UpdateState(curState) | ||
|
@@ -259,12 +254,17 @@ func (r *delegatingResolver) updateProxyResolverState(state resolver.State) erro | |
logger.Infof("Addresses received from proxy resolver: %s", state.Addresses) | ||
} | ||
if len(state.Endpoints) > 0 { | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this blank line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
// We expect exactly one address per endpoint because the proxy | ||
// resolver uses "dns" resolution. | ||
r.proxyAddrs = make([]resolver.Address, 0, len(state.Endpoints)) | ||
for _, endpoint := range state.Endpoints { | ||
r.proxyAddrs = append(r.proxyAddrs, endpoint.Addresses...) | ||
arjan-bal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} else { | ||
} else if state.Addresses != nil { | ||
r.proxyAddrs = state.Addresses | ||
dfawley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} else { | ||
r.proxyAddrs = []resolver.Address{} // ensure proxyAddrs is non-nil to indicate an update has been received | ||
} | ||
err := r.updateClientConnStateLocked() | ||
// Another possible approach was to block until updates are received from | ||
|
Oops, something went wrong.
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.
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.
Please move this down to where you commented about 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.
Done.
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.