-
Notifications
You must be signed in to change notification settings - Fork 208
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
Change "127.0.0.1" to SIDECAR_IP to dynamically account for IPv4 vs. IPv6 environments #649
Conversation
@artursouza Wasn't there was a particular reason why 127.0.0.1 was used instead of localhost? |
@mukundansundar according to #213, it was changed from localhost to 127.0.0.1 "to avoid local OS specific DNS lookups that might hinder performance". My changes here don't reintroduce the use of |
Work in progress, please do not merge |
Signed-off-by: Will Tsai <[email protected]>
* Upgrade okhttp-mock dependency Version 1.3.2 was never deployed to Maven Central * No longer refer to JCenter, as it has been shut down Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2.3.1 to 2.4.0. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](actions/setup-java@v2.3.1...v2.4.0) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
* Upgrade Dapr CLI and runtime. Signed-off-by: Artur Souza <[email protected]> * Fix expected vault output. Signed-off-by: Artur Souza <[email protected]> Signed-off-by: Will Tsai <[email protected]>
* Update LICENSE to Apache 2.0 Signed-off-by: Artur Souza <[email protected]> * Update headers to Apache 2. Signed-off-by: Artur Souza <[email protected]> Co-authored-by: Artur Souza <[email protected]> Signed-off-by: Will Tsai <[email protected]>
Bumps [actions/github-script](https://github.com/actions/github-script) from 1 to 5. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@v1...v5) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Will Tsai <[email protected]>
Issue reference: dapr/docs#2039 Signed-off-by: Will <[email protected]> Signed-off-by: Will Tsai <[email protected]>
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](actions/setup-java@v2.4.0...v2.5.0) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Artur Souza <[email protected]> Signed-off-by: Will Tsai <[email protected]>
* inital draft for config api Signed-off-by: Pravin Pushkar <[email protected]> * Introducing new client for preview apis and code refactoring Signed-off-by: Pravin Pushkar <[email protected]> * Unit tests and code refactoring Signed-off-by: Pravin Pushkar <[email protected]> * Adding integration test Signed-off-by: pravinpushkar <[email protected]> * Copyright changes Signed-off-by: pravinpushkar <[email protected]> * Review comments fixes Signed-off-by: pravinpushkar <[email protected]> * Removed DaprPreviewClientProxy and updated example README Signed-off-by: pravinpushkar <[email protected]> * Adding validate workflow for cofiguration api example Signed-off-by: pravinpushkar <[email protected]> * fixing example autovalidation and code coverage Signed-off-by: pravinpushkar <[email protected]> * Fixing autovalidation and removing getAllConfiguration Signed-off-by: pravinpushkar <[email protected]> * Fixing review comments Signed-off-by: pravinpushkar <[email protected]> * Add regex header checkstyle. Signed-off-by: Artur Souza <[email protected]> * Fix headers and add javadocs to some. Signed-off-by: Artur Souza <[email protected]> Co-authored-by: Artur Souza <[email protected]> Signed-off-by: Will Tsai <[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.
I will give another pass tomorrow. Thanks.
Signed-off-by: Will Tsai <[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.
Just a minor change.
* @return The loopback address String | ||
*/ | ||
public static String getHostLoopbackAddress() { | ||
return InetAddress.getLoopbackAddress().getHostAddress(); |
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.
Can this method automatically return the Ipv6 between "[]"?
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.
@artursouza Sorry for the delay, finally had some time to look into this. I changed some unit tests locally to validate IPv6 sidecar IP constants contained within "[]" and it seems like your suggestion is viable - for both URL endpoint invocation formats and Dapr client instantiation. Great recommendation!
However, before I proceed, I need to validate an implementation detail with you. To test for whether an address is IPv6, it would be convenient to leverage the Apache Commons Validator, though you have recommended against bringing in 3P libraries beyond the test scope. Is it possible to get an exception for this case, or do I have to write a custom IPv6 validator within NetworkUtils?
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.
@willtsai Is it complex to write a validator for IPv6 ? both standard pattern and hex compressed pattern along with IPv4 validation?
I am wary of adding a new dependency specifically for one validation ....
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.
Understood - should not be too complex but I wanted to see if the work (and subsequent unit tests) could be avoided. Seems like adding a new dependency is not worth it here, so I'll work on the custom validator.
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.
I started the implementation for this and have a working validator, but then realized that this would introduce inconsistencies into the Property<String> SIDECAR_IP
config object since the result would be that the special IPv6 formatting would only get applied when DEFAULT_SIDECAR_IP
is used in fallback scenarios, so the IPv6 address would not get "[]" applied to them when they are sourced from the system property name or env variable.
Thus, I think there are two options:
- Leave the implementation of adding "[]" to the http address to the client and thus just modifying our test clients accordingly, i.e. code in this PR remain as is.
- Make modifications to the
Property
and/orProperties
objects to introduce a new object classIpProperty.java
or equivalent that would apply the required IPv6 formatting to the IP address it returns.
@artursouza @mukundansundar - what are your thoughts here? which option would you prefer? (I personally think option 1 introduces less surprises to the client who may not be expecting IPv6 address to be pre-formatted for http URLs)
@willtsai mind resolving the conflicts? |
Signed-off-by: Will <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Will Tsai <[email protected]>
@cicoyle i've addressed all merge conflicts and test failures, can you please take another look? (i think the build tests just need to be re-run) |
Signed-off-by: Will Tsai <[email protected]>
Signed-off-by: Artur Souza <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #649 +/- ##
=========================================
Coverage 77.60% 77.61%
- Complexity 1570 1571 +1
=========================================
Files 144 144
Lines 4765 4767 +2
Branches 554 554
=========================================
+ Hits 3698 3700 +2
Misses 781 781
Partials 286 286 ☔ View full report in Codecov by Sentry. |
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 - nice to see this coming to a closing 🎉
woo! thanks @cicoyle @artursouza 🥳 |
Description
I've made some changes to move away from hardcoded "127.0.0.1" IP addresses (representing
localhost
) to make the SDK and Tests compatible with exclusively IPv6 environments:Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #218
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: