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 configuring the order of the upstream dns service discovery resolve #7935

Conversation

monkeyDluffy6017
Copy link
Contributor

…very resolve

Description

Some users are having problems with the upstream DNS service discovery feature, because the current DNS resolution order is fixed: 1. "last" 2. "SRV" 3. "A" 4. "AAAA" 5. "CNAME".
"last" means the last successful resolving method; that is, if the last resolving is successful, the last resolving method will be used first.
This causes the problem that if for some reason the A record is resolved successfully, the higher priority SRV record will not be resolved in the future, and the user expects to get the result of resolving the SRV record.

As a user, I want to configure how and in what order the upstream DNS service discovery function resolves, and APISIX is able to resolve in the way and in the order I configure.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

Copy link
Contributor

@tokers tokers left a comment

Choose a reason for hiding this comment

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

uniqueItems = true,
items = {
enum = {"last", "SRV", "A", "AAAA", "CNAME"},
-- ["not"] = {
Copy link
Member

Choose a reason for hiding this comment

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

Just for debug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

servers:
- "127.0.0.1:1053"
order:
- A
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to add some test about invalid input, like a or repeated record type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

id: 1
--- must_die
--- error_log
matches none of the enum values
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a test case: DNS Server returns SRV records first for the same domain name, and the next query returns A records?

@monkeyDluffy6017 monkeyDluffy6017 requested review from spacewander and tzssangglass and removed request for spacewander September 26, 2022 05:46
@monkeyDluffy6017
Copy link
Contributor Author

Done

@tzssangglass tzssangglass changed the title feat: support configuring the order of the upstream dns service disco… feat: support configuring the order of the upstream dns service discovery resolve Sep 26, 2022
@spacewander spacewander merged commit 4570fec into apache:master Sep 26, 2022
Liu-Junlin pushed a commit to Liu-Junlin/apisix that referenced this pull request Nov 4, 2022
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.

5 participants