docs: all enterprise locality labels now optional

This commit is contained in:
Jared Kirschner 2022-09-19 14:31:15 -07:00
parent 1d7c82c017
commit 90aab0b3bb
3 changed files with 42 additions and 17 deletions

3
.changelog/14679.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
dns: **(Enterprise Only)** All enterprise locality labels are now optional in DNS lookups. For example, service lookups support the following format: <tag>.]<service>.service[.<namespace>.ns][.<partition>.ap][.<datacenter>.dc]<domain>`.
```

View File

@ -1344,13 +1344,12 @@ Valid time units are 'ns', 'us' (or 'µs'), 'ms', 's', 'm', 'h'."
equivalent to "no max age". To get a fresh value from the cache use a very small value equivalent to "no max age". To get a fresh value from the cache use a very small value
of `1ns` instead of 0. of `1ns` instead of 0.
- `prefer_namespace` ((#dns_prefer_namespace)) <EnterpriseAlert inline /> **Deprecated in - `prefer_namespace` ((#dns_prefer_namespace)) <EnterpriseAlert inline /> **Deprecated in Consul 1.11.
Consul 1.11. Use the [canonical DNS format](/docs/discovery/dns#namespaced-partitioned-services) instead.** - Use the [canonical DNS format for enterprise service lookups](/docs/discovery/dns#service-lookups-for-consul-enterprise) instead.** -
When set to true, in a DNS query for a service, the label between the domain When set to true, in a DNS query for a service, a single label between the domain
and the `service` label will be treated as a namespace name instead of a datacenter. and the `service` label is treated as a namespace name instead of a datacenter.
When set to false, the default, the behavior will be the same as non-Enterprise When set to false, the default, the behavior is the same as non-Enterprise
versions and will assume the label is the datacenter. See: [this section](/docs/discovery/dns#namespaced-services) versions and treats the single label as the datacenter.
for more details.
- `domain` Equivalent to the [`-domain` command-line flag](/docs/agent/config/cli-flags#_domain). - `domain` Equivalent to the [`-domain` command-line flag](/docs/agent/config/cli-flags#_domain).

View File

@ -353,15 +353,8 @@ $ echo -n "20010db800010002cafe000000001337" | perl -ne 'printf join(":", unpack
By default, all service lookups use the `default` namespace By default, all service lookups use the `default` namespace
within the partition and datacenter of the Consul agent that received the DNS query. within the partition and datacenter of the Consul agent that received the DNS query.
To lookup services in another namespace, partition, and/or datacenter,
Use the following query format to specify a namespace, partition, and/or datacenter use the [canonical format](#canonical-format).
for all service lookup types except `.query`,
including `.service`, `.connect`, `.virtual`, and `.ingress`.
At least two of those three fields (`namespace`, `partition`, `datacenter`)
must be specified.
```text
[<tag>.]<service>.service.<namespace>.ns.<partition>.ap.<datacenter>.dc.<domain>
```
Consul server agents are in the `default` partition. Consul server agents are in the `default` partition.
If DNS queries are addressed to Consul server agents, If DNS queries are addressed to Consul server agents,
@ -369,7 +362,37 @@ service lookups to non-`default` partitions must explicitly specify
the partition of the target service. the partition of the target service.
To lookup services imported from a cluster peer, To lookup services imported from a cluster peer,
use a [service virtual IP lookups for Consul Enterprise](#service-virtual-ip-lookups-for-consul-enterprise) instead. refer to [service virtual IP lookups for Consul Enterprise](#service-virtual-ip-lookups-for-consul-enterprise) instead.
#### Canonical format
Use the following query format to specify namespace, partition, and/or datacenter
for all service lookup types except `.query`,
including `.service`, `.connect`, `.virtual`, and `.ingress`.
All three fields (`namespace`, `partition`, `datacenter`) are optional.
```text
[<tag>.]<service>.service[.<namespace>.ns][.<partition>.ap][.<datacenter>.dc]<domain>
```
#### Alternative formats for specifying namespace
Though the [canonical format](#canonical-format) is recommended for readability,
the following query formats may be used to specify namespace-only:
- Specify namespace and datacenter pair
```text
[<tag>.]<service>.service.<namespace>.<datacenter>.<domain>
```
- **Deprecated in Consul 1.11:**
Specify namespace-only if DNS queries are addressed to a Consul agent with
[`dns_config.prefer_namespace`](/docs/agent/config/config-files#dns_prefer_namespace)
set to true
```text
[<tag>.]<service>.service.<namespace>.<domain>
```
### Prepared Query Lookups ### Prepared Query Lookups