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

feat: Support DNS resolution settings #3974

Merged
merged 16 commits into from
Aug 1, 2024
Merged

feat: Support DNS resolution settings #3974

merged 16 commits into from
Aug 1, 2024

Conversation

alexwo
Copy link
Contributor

@alexwo alexwo commented Jul 30, 2024

DNS resolution settings

The purpose is to allow control over DNS resolution settings for non static cluster endpoints.
With this PR, it will be possible to define custom DNS resolution settings through a BTP policy.

Fixes # #3690

Signed-off-by: Alexander Volchok <[email protected]>
@alexwo alexwo requested a review from a team as a code owner July 30, 2024 14:50
alexwo added 4 commits July 30, 2024 16:55
Signed-off-by: Alexander Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 89.15663% with 9 lines in your changes missing coverage. Please review.

Project coverage is 67.59%. Comparing base (8d82ea9) to head (bf83d06).

Files Patch % Lines
internal/xds/translator/cluster.go 84.61% 6 Missing and 2 partials ⚠️
internal/xds/translator/translator.go 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3974      +/-   ##
==========================================
+ Coverage   67.56%   67.59%   +0.02%     
==========================================
  Files         183      183              
  Lines       22406    22444      +38     
==========================================
+ Hits        15139    15171      +32     
- Misses       6188     6193       +5     
- Partials     1079     1080       +1     

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

Signed-off-by: Alexander Volchok <[email protected]>
Signed-off-by: Alexander Volchok <[email protected]>
@alexwo
Copy link
Contributor Author

alexwo commented Jul 30, 2024

/retest

// DNSSettings includes dns resolution settings.
//
// +optional
DNSSettings *DNSSettings `json:"dnsSettings,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer just dns

@@ -772,6 +772,10 @@ func processXdsCluster(tCtx *types.ResourceVersionTable, httpRoute *ir.HTTPRoute
clusterArgs.backendConnection = bt.BackendConnection
}

if httpRoute.DNS != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

is something similar needed for grpc, tcp, udp, tls ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its probably can be still applicable If the route specifies a DNS hostname, it should function for all protocols within the context of the Envoy gateway cluster.

Copy link
Contributor

Choose a reason for hiding this comment

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

@arkodg - do you want to create an issue following DNS setting implementation across routes and non-routes? I think that we can start out with limited support for HTTP routes.

Copy link
Contributor

@arkodg arkodg Jul 31, 2024

Choose a reason for hiding this comment

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

yeah for xRoutes is fine for now, what I was trying to get at - the code is not uniform, for e.g. for TCP Route translation we have another code flow

if err := addXdsCluster(tCtx, &xdsClusterArgs{
so we missed adding it there

Copy link
Contributor Author

@alexwo alexwo Jul 31, 2024

Choose a reason for hiding this comment

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

Indeed, thanks for catching it.
I have just added that both to TCP and UDP routes.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks @alexwo can you help with the tech debt here , is it possible to reuse processXdsCluster for other route types, so we dont miss something like this again

Copy link
Contributor Author

@alexwo alexwo Jul 31, 2024

Choose a reason for hiding this comment

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

Sure, I have modified processXdsCluster to be compatible with any type that can return cluster arguments, currently used for TCP, UDP, and HTTP routes.​

@guydc
Copy link
Contributor

guydc commented Jul 31, 2024

/retest

if args.dns.DNSRefreshRate.Duration > 0 {
cluster.DnsRefreshRate = durationpb.New(args.dns.DNSRefreshRate.Duration)
}
if args.dns.RespectDNSTTL != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this live outside the the args.dns.DNSRefreshRate nil check, or does envoy require DNSRefreshRate to be set for RespectDNSTTL to be set?

Copy link
Contributor Author

@alexwo alexwo Jul 31, 2024

Choose a reason for hiding this comment

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

fixed

@@ -772,6 +772,10 @@ func processXdsCluster(tCtx *types.ResourceVersionTable, httpRoute *ir.HTTPRoute
clusterArgs.backendConnection = bt.BackendConnection
}

if httpRoute.DNS != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

@arkodg - do you want to create an issue following DNS setting implementation across routes and non-routes? I think that we can start out with limited support for HTTP routes.

@alexwo
Copy link
Contributor Author

alexwo commented Jul 31, 2024

/retest

alexwo added 2 commits July 31, 2024 23:17
Signed-off-by: Alexander Volchok <[email protected]>
@alexwo
Copy link
Contributor Author

alexwo commented Aug 1, 2024

/retest

Signed-off-by: Alexander Volchok <[email protected]>
@alexwo
Copy link
Contributor Author

alexwo commented Aug 1, 2024

/retest

Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks !

@arkodg arkodg requested review from a team August 1, 2024 16:33
@guydc guydc merged commit f4c53f4 into envoyproxy:main Aug 1, 2024
27 checks passed
@alexwo alexwo deleted the dns branch August 1, 2024 17:44
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.

3 participants