You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by Zexuan Luo <sp...@apache.org> on 2021/02/04 07:18:56 UTC

[DISCUSS] add per node DNS selector

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.

Re: [DISCUSS] add per node DNS selector

Posted by Zhang Chao <zc...@gmail.com>.
What if we make this feature into another service discovery mechanism like
“DNS”?

Chao Zhang
https://github.com/tokers

On February 4, 2021 at 3:24:56 PM, Ming Wen (wenming@apache.org) wrote:

Re: [DISCUSS] add per node DNS selector

Posted by Ming Wen <we...@apache.org>.
I am not sure whether user will use domain and IP together like:
```
"nodes": {
    {"host": "test.consul.service", "weight": 1, "selector": "all"},
    {"host": "1.1.1.1", "weight": 1}
}
```

Thanks,
Ming Wen, Apache APISIX PMC Chair
Twitter: _WenMing


Zexuan Luo <sp...@apache.org> 于2021年2月4日周四 下午3:19写道:

> 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.
>