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

Updated endpoint parsing #618

Merged
merged 13 commits into from
Oct 31, 2023

Conversation

elena-kolevska
Copy link
Contributor

@elena-kolevska elena-kolevska commented Oct 16, 2023

Description

This PR updates the python-sdk so it satisfies the requirements for gRPC endpoint parsing added in dapr/proposals#40.

It also adds support for all URIs that the gRPC name resolution document defines, including dns links with authority, unix paths with absolute and relative sockets, unix-abstract and virtual sockets.

Backwards compatibility has been maintained for endpoints where tls was inferred based on the scheme https.

Issue reference

#619

Checklist

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

scheme = self.get_scheme()
port = "" if len(self.get_port()) == 0 else f":{self.port}"

if scheme == "unix":
Copy link
Member

Choose a reason for hiding this comment

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

Is there a warning if the user uses the deprecated "https" or "http" schemas?

Copy link
Contributor Author

@elena-kolevska elena-kolevska Oct 17, 2023

Choose a reason for hiding this comment

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

Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
@elena-kolevska elena-kolevska marked this pull request as ready for review October 17, 2023 19:07
@elena-kolevska elena-kolevska requested review from a team as code owners October 17, 2023 19:07
@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Attention: 41 lines in your changes are missing coverage. Please review.

Comparison is base (6171b67) 86.40% compared to head (59b4e42) 86.13%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #618      +/-   ##
==========================================
- Coverage   86.40%   86.13%   -0.28%     
==========================================
  Files          74       74              
  Lines        3605     3700      +95     
==========================================
+ Hits         3115     3187      +72     
- Misses        490      513      +23     
Files Coverage Δ
dapr/aio/clients/grpc/client.py 70.36% <80.00%> (-0.32%) ⬇️
dapr/clients/grpc/client.py 84.83% <76.92%> (-0.46%) ⬇️
dapr/conf/helpers.py 71.65% <71.65%> (+16.39%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Copy link
Member

@berndverst berndverst left a comment

Choose a reason for hiding this comment

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

Please create a follow-up PR to remove these orphaned comments.

self.assertEqual(testcase["scheme"], o[0])
self.assertEqual(testcase["host"], o[1])
self.assertEqual(testcase["port"], o[2])
# if testcase["error"]:
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove the commented out lines please if these are not necessary?

@berndverst berndverst merged commit 690ac99 into dapr:master Oct 31, 2023
11 of 13 checks passed
@elena-kolevska
Copy link
Contributor Author

Thanks @berndverst. Good catch, I was using those prints to generate the matrix in this proposal.
Fixed in #633

DEFAULT_HOSTNAME = "localhost"
DEFAULT_PORT = 443
DEFAULT_AUTHORITY = ""
ACCEPTED_SCHEMES = ["dns", "unix", "unix-abstract", "vsock", "http", "https", "grpc", "grpcs"]
Copy link

Choose a reason for hiding this comment

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

cc @elena-kolevska
something's off here, both grpc and grpcs are not present in the naming resolution doc and are also missing in the go-sdk: https://github.com/dapr/go-sdk/blob/main/client/internal/parse.go#L160

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in this PR: #700

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants