Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[DISCUSS] add per node DNS selector #3517

Closed
spacewander opened this issue Feb 4, 2021 · 2 comments · Fixed by #3629
Closed

[DISCUSS] add per node DNS selector #3517

spacewander opened this issue Feb 4, 2021 · 2 comments · Fixed by #3629
Labels

Comments

@spacewander
Copy link
Member

When resolving domain, currently we take one of the DNS record randomly. When we want to do service discovery via DNS, sometimes we hope the domain resolving will return all the records. For example, with:

"nodes": {
    "test.consul.service": 1
}

We may want to get all IPs instead of a random one.

So my purpose is to provide a per-node dns selector to control the behavior.

For example,

"nodes": {
    {"host": "test.consul.service", "weight": 1, "selector": "random"}
}

is equal to previous configuration.

While

"nodes": {
    {"host": "test.consul.service", "weight": 1, "selector": "all"},
    {"host": "1.1.1.1", "weight": 1}
}

with test.consul.service be resolved as 1.1.1.2 and 1.1.1.3 will get this result:

"nodes": {
    {"host": "1.1.1.1", "weight": 2},
    {"host": "1.1.1.2", "weight": 1},
    {"host": "1.1.1.3", "weight": 1},
}

Note that all the IPs from test.consul.service share the same weight.
And the selector doesn't affect SRV record, which is a difference story.

@tokers
Copy link
Contributor

tokers commented Feb 4, 2021

Maybe add a new DNS based service discovery mechanism for the "selector: all" is better?

@sysulq
Copy link
Contributor

sysulq commented Feb 20, 2021

Nice to see this enhancement, it's really useful when we do discovery through DNS way.

And host 1.1.1.1 should be recounted based on the number and weight of resovled IPs base on test.consul.service.

By the way, is there any plan to support SRV record?

spacewander added a commit to spacewander/incubator-apisix that referenced this issue Feb 22, 2021
Fix apache#3517
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
spacewander added a commit to spacewander/incubator-apisix that referenced this issue Feb 22, 2021
Fix apache#3517
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
spacewander added a commit to spacewander/incubator-apisix that referenced this issue Feb 22, 2021
Fix apache#3517
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
spacewander added a commit to spacewander/incubator-apisix that referenced this issue Feb 22, 2021
Fix apache#3517
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
spacewander added a commit to spacewander/incubator-apisix that referenced this issue Feb 22, 2021
Fix apache#3517
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
spacewander added a commit to spacewander/incubator-apisix that referenced this issue Feb 22, 2021
Fix apache#3517
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
spacewander added a commit to spacewander/incubator-apisix that referenced this issue Feb 22, 2021
Fix apache#3517
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
spacewander added a commit that referenced this issue Feb 25, 2021
Fix #3517
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants