Skip to content

Refactor dns cluster api#36353

Merged
mattklein123 merged 55 commits intoenvoyproxy:mainfrom
Stevenjin8:refactor/dns-api
Dec 19, 2024
Merged

Refactor dns cluster api#36353
mattklein123 merged 55 commits intoenvoyproxy:mainfrom
Stevenjin8:refactor/dns-api

Conversation

@Stevenjin8
Copy link
Copy Markdown
Contributor

@Stevenjin8 Stevenjin8 commented Sep 26, 2024

TODO:

  • Create new DnsConfig proto
  • Update deprecation docs
  • Update strict dns cluster to consume new dns config
  • Update logical dns cluster to consume new dns config
  • Test changes

Commit Message: Refactor DNS cluster configuration in its own extension
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #36353 was opened by Stevenjin8.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @mattklein123
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #36353 was opened by Stevenjin8.

see: more, trace.

@Stevenjin8
Copy link
Copy Markdown
Contributor Author

@markdroth @wbpcode Just wanted to check in that I'm going in the right direction

@Stevenjin8 Stevenjin8 force-pushed the refactor/dns-api branch 2 times, most recently from a305ccc to 928ef02 Compare October 1, 2024 16:46
@Stevenjin8 Stevenjin8 marked this pull request as ready for review October 1, 2024 16:47
Comment thread source/common/upstream/upstream_impl.cc
Comment thread source/extensions/clusters/strict_dns/strict_dns_cluster.cc Outdated
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
@Stevenjin8 Stevenjin8 changed the title Refactor/dns api Refactor dns cluster api Oct 2, 2024
@Stevenjin8
Copy link
Copy Markdown
Contributor Author

@markdroth I would also appreciate some guidance on what you expect for testing.

@mattklein123
Copy link
Copy Markdown
Member

Sorry can you provide some context on this?

/wait

Copy link
Copy Markdown
Contributor

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

@mattklein123 For context, see #35479 (comment).

@Stevenjin8, I'm not the right person to ask about testing for the Envoy implementation, so I'll let one of the Envoy maintainers do that. My feedback here is just on the xDS API changes.

Please let me know if you have any questions. Thanks!

Comment thread api/envoy/config/cluster/v3/cluster.proto
Comment thread api/envoy/extensions/clusters/dns/v3/cluster.proto Outdated
Comment thread api/envoy/extensions/clusters/dns/v3/cluster.proto Outdated
Comment thread api/envoy/extensions/clusters/dns/v3/cluster.proto Outdated
Comment thread api/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto Outdated
Comment thread api/envoy/config/cluster/v3/cluster.proto Outdated
Comment thread api/envoy/config/cluster/v3/cluster.proto Outdated
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
@Stevenjin8 Stevenjin8 requested a review from markdroth December 12, 2024 19:16
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
@Stevenjin8
Copy link
Copy Markdown
Contributor Author

Forgot to merge main. Should be ready for another review now (even though not much changed)

Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
mattklein123
mattklein123 previously approved these changes Dec 16, 2024
@mattklein123 mattklein123 enabled auto-merge (squash) December 16, 2024 22:40
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
auto-merge was automatically disabled December 17, 2024 15:51

Head branch was pushed to by a user without write access

@Stevenjin8
Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
Copy link
Copy Markdown
Contributor

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Just one minor comment improvement needed -- otherwise, this looks great from an API perspective!

Comment thread api/envoy/extensions/clusters/dns/v3/dns_cluster.proto Outdated
Signed-off-by: Steven Jin Xuan <sjinxuan@microsoft.com>
@Stevenjin8 Stevenjin8 requested a review from markdroth December 18, 2024 19:16
@markdroth
Copy link
Copy Markdown
Contributor

This looks great from an API perspective!

/lgtm api

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks for slogging through!

@mattklein123 mattklein123 merged commit 640fcc0 into envoyproxy:main Dec 19, 2024
phlax pushed a commit that referenced this pull request Aug 6, 2025
The main idea here is tackling #37145 (which is a follow up from
#36353).
 
This approach simplifies the code merging the two current implementation
of DNS cluster (logical and strict) by removing unnecessary logical DNS,
as it can be treated as a special case of strict DNS.

According to the documentation:

_When using **strict DNS** service discovery, Envoy will continuously
and asynchronously resolve the specified DNS targets. Each returned IP
address in the DNS result will be considered an explicit host in the
upstream cluster. This means that if the query returns three IP
addresses, Envoy will assume the cluster has three hosts, and all three
should be load balanced to. If a host is removed from the result Envoy
assumes it no longer exists and will drain traffic from any existing
connection pools_

_**Logical DNS** uses a similar asynchronous resolution mechanism to
strict DNS. However, instead of strictly taking the results of the DNS
query and assuming that they comprise the entire upstream cluster, a
logical DNS cluster only uses the first IP address returned when a new
connection needs to be initiated. Thus, a single logical connection pool
may contain physical connections to a variety of different upstream
hosts. Connections are never drained, including on a successful DNS
resolution that returns 0 hosts._

---------

Signed-off-by: Gustavo <grnmeira@gmail.com>
eziskind pushed a commit to eziskind/envoy that referenced this pull request Aug 8, 2025
The main idea here is tackling envoyproxy#37145 (which is a follow up from
envoyproxy#36353).
 
This approach simplifies the code merging the two current implementation
of DNS cluster (logical and strict) by removing unnecessary logical DNS,
as it can be treated as a special case of strict DNS.

According to the documentation:

_When using **strict DNS** service discovery, Envoy will continuously
and asynchronously resolve the specified DNS targets. Each returned IP
address in the DNS result will be considered an explicit host in the
upstream cluster. This means that if the query returns three IP
addresses, Envoy will assume the cluster has three hosts, and all three
should be load balanced to. If a host is removed from the result Envoy
assumes it no longer exists and will drain traffic from any existing
connection pools_

_**Logical DNS** uses a similar asynchronous resolution mechanism to
strict DNS. However, instead of strictly taking the results of the DNS
query and assuming that they comprise the entire upstream cluster, a
logical DNS cluster only uses the first IP address returned when a new
connection needs to be initiated. Thus, a single logical connection pool
may contain physical connections to a variety of different upstream
hosts. Connections are never drained, including on a successful DNS
resolution that returns 0 hosts._

---------

Signed-off-by: Gustavo <grnmeira@gmail.com>
Signed-off-by: Elisha Ziskind <eziskind@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deps Approval required for changes to Envoy's external dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants