-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add option to disable dns resolve #2634
Conversation
Signed-off-by: hlts2 <[email protected]>
WalkthroughWalkthroughThe changes enhance the gRPC client functionality, particularly regarding DNS address resolution. A new method, Changes
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files skipped from review as they are similar to previous changes (1)
Additional comments not posted (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
[CHATOPS:HELP] ChatOps commands.
|
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
internal/net/grpc/client.go (1)
951-955
: Implementation looks good!The
SetDisableResolveDNSAddr
function allows for dynamically disabling DNS resolution for specific addresses, which is necessary when connecting to multiple locations. The comments provide good context on the rationale behind this implementation.A few additional suggestions:
- Consider adding unit tests to verify the behavior of this function.
- Consider documenting this function in the
Client
interface definition for better visibility.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
apis/grpc/v1/payload/payload.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
apis/grpc/v1/rpc/errdetails/error_details.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
Files selected for processing (3)
- internal/net/grpc/client.go (3 hunks)
- pkg/gateway/mirror/service/gateway.go (2 hunks)
- pkg/gateway/mirror/service/mirror.go (1 hunks)
Additional comments not posted (3)
pkg/gateway/mirror/service/gateway.go (1)
147-161
: LGTM!The changes to the
Do
method enhance its error handling capabilities and introduce a robust fallback mechanism. Key improvements include:
- Checking for an empty
target
and returning an appropriate error.- Creating a new
fctx
variable to store the forwarded context.- Implementing a fallback mechanism using a round-robin approach to attempt the gRPC call with other available connections when an error occurs.
- Handling the case where the connection's target matches the original target by returning a specific error.
- Attempting to call the provided function
f
with the new connection's target as a fallback.These enhancements allow the method to better manage connection issues, improve the reliability of service calls, and increase the likelihood of successful gRPC operations.
pkg/gateway/mirror/service/mirror.go (1)
322-322
: LGTM!The change to disable DNS resolution for the target address before attempting to connect aligns with the PR objective and could potentially improve connection reliability in certain scenarios.
Please verify that disabling DNS resolution does not introduce any unintended side effects or break existing functionality. Consider running tests or performing manual verification to ensure the change behaves as expected.
Verification successful
LGTM! The change appears to be safe, but careful testing and monitoring are advised.
The implementation to disable DNS resolution for specific addresses in the
Connect
method is localized and doesn't seem to affect the global DNS behavior of the system. However, given the extensive use of DNS throughout the project, it's crucial to ensure this change doesn't introduce any unintended side effects.
- Thoroughly test the mirror service functionality, especially in scenarios where DNS resolution is disabled for certain addresses.
- Monitor the performance and behavior of the mirror service in production after deploying this change.
- Consider implementing logging or metrics to track when and how often DNS resolution is disabled, which could help in future optimizations.
Please proceed with caution and keep an eye on the system's behavior after deployment.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if disabling DNS resolution has any impact on existing functionality. # Test: Search for potential side effects or issues related to disabling DNS resolution. rg --type go -i 'dns|resolve' -A 5Length of output: 191007
internal/net/grpc/client.go (1)
986-992
: Changes look good!The modifications to the
Connect
function align with the purpose of theSetDisableResolveDNSAddr
function. The added check on thedisableResolveDNSAddrs
map allows for dynamically disabling DNS resolution for specific addresses. The logic is correct and does not introduce any issues.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2634 +/- ##
==========================================
+ Coverage 24.23% 24.35% +0.11%
==========================================
Files 534 536 +2
Lines 46261 46459 +198
==========================================
+ Hits 11213 11315 +102
- Misses 34296 34375 +79
- Partials 752 769 +17 ☔ View full report in Codecov by Sentry. |
[FOSSA] The scan result will be available at https://app.fossa.com/projects/custom%2B21465%2Fvald/refs/branch/fix%2Fmirror%2Fadd-disable-resolve-dns/0bf69756955cbb7b7bc80e3441b776331fbef2ed |
Signed-off-by: hlts2 <[email protected]>
Deploying vald with Cloudflare Pages
|
Signed-off-by: hlts2 <[email protected]>
Signed-off-by: hlts2 <[email protected]>
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
* fix: add option to disable dns resolve Signed-off-by: hlts2 <[email protected]> * fix: add mock function Signed-off-by: hlts2 <[email protected]> * fix: unimplemented error Signed-off-by: hlts2 <[email protected]> * fix: change ForwardedContext method to private Signed-off-by: hlts2 <[email protected]> --------- Signed-off-by: hlts2 <[email protected]>
* fix: add option to disable dns resolve * fix: add mock function * fix: unimplemented error * fix: change ForwardedContext method to private --------- Signed-off-by: hlts2 <[email protected]> Co-authored-by: Hiroto Funakoshi <[email protected]>
Description
When we verified the mirror gateway to connect to multiple locations, we could not connect when dns resolve was enabled. Therefore, I added an interface to disable it.
Related Issue
Versions
Checklist
Special notes for your reviewer
Summary by CodeRabbit
New Features
Bug Fixes