Support multiple namespaces for Consul and ConsulCatalog providers
Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
parent
f352c34136
commit
f90e3817e8
28 changed files with 531 additions and 152 deletions
|
@ -525,7 +525,7 @@ providers:
|
|||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--providers.consulcatalog.defaultRule="Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)"
|
||||
--providers.consulcatalog.defaultRule=Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)
|
||||
# ...
|
||||
```
|
||||
|
||||
|
@ -669,30 +669,76 @@ For additional information, refer to [Restrict the Scope of Service Discovery](.
|
|||
|
||||
### `namespace`
|
||||
|
||||
??? warning "Deprecated in favor of the [`namespaces`](#namespaces) option."
|
||||
|
||||
_Optional, Default=""_
|
||||
|
||||
The `namespace` option defines the namespace in which the consul catalog services will be discovered.
|
||||
|
||||
!!! warning
|
||||
|
||||
The namespace option only works with [Consul Enterprise](https://www.consul.io/docs/enterprise),
|
||||
which provides the [Namespaces](https://www.consul.io/docs/enterprise/namespaces) feature.
|
||||
|
||||
!!! warning
|
||||
|
||||
One should only define either the `namespaces` option or the `namespace` option.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
providers:
|
||||
consulCatalog:
|
||||
namespace: "production"
|
||||
# ...
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[providers.consulCatalog]
|
||||
namespace = "production"
|
||||
# ...
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--providers.consulcatalog.namespace=production
|
||||
# ...
|
||||
```
|
||||
|
||||
### `namespaces`
|
||||
|
||||
_Optional, Default=""_
|
||||
|
||||
The `namespace` option defines the namespace in which the consul catalog services will be discovered.
|
||||
The `namespaces` option defines the namespaces in which the consul catalog services will be discovered.
|
||||
When using the `namespaces` option, the discovered configuration object names will be suffixed as shown below:
|
||||
|
||||
```text
|
||||
<resource-name>@consulcatalog-<namespace>
|
||||
```
|
||||
|
||||
!!! warning
|
||||
|
||||
The namespace option only works with [Consul Enterprise](https://www.consul.io/docs/enterprise),
|
||||
The namespaces option only works with [Consul Enterprise](https://www.consul.io/docs/enterprise),
|
||||
which provides the [Namespaces](https://www.consul.io/docs/enterprise/namespaces) feature.
|
||||
|
||||
!!! warning
|
||||
|
||||
One should only define either the `namespaces` option or the `namespace` option.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
providers:
|
||||
consulCatalog:
|
||||
namespace: "production"
|
||||
namespaces:
|
||||
- "ns1"
|
||||
- "ns2"
|
||||
# ...
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[providers.consulCatalog]
|
||||
namespace = "production"
|
||||
namespaces = ["ns1", "ns2"]
|
||||
# ...
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--providers.consulcatalog.namespace=production
|
||||
--providers.consulcatalog.namespaces=ns1,ns2
|
||||
# ...
|
||||
```
|
||||
|
||||
|
|
|
@ -61,30 +61,76 @@ providers:
|
|||
|
||||
### `namespace`
|
||||
|
||||
??? warning "Deprecated in favor of the [`namespaces`](#namespaces) option."
|
||||
|
||||
_Optional, Default=""_
|
||||
|
||||
The `namespace` option defines the namespace to query.
|
||||
|
||||
!!! warning
|
||||
|
||||
The namespace option only works with [Consul Enterprise](https://www.consul.io/docs/enterprise),
|
||||
which provides the [Namespaces](https://www.consul.io/docs/enterprise/namespaces) feature.
|
||||
|
||||
!!! warning
|
||||
|
||||
One should only define either the `namespaces` option or the `namespace` option.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
providers:
|
||||
consul:
|
||||
# ...
|
||||
namespace: "production"
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[providers.consul]
|
||||
# ...
|
||||
namespace = "production"
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--providers.consul.namespace=production
|
||||
```
|
||||
|
||||
### `namespaces`
|
||||
|
||||
_Optional, Default=""_
|
||||
|
||||
The `namespace` option defines the namespace to query.
|
||||
The `namespaces` option defines the namespaces to query.
|
||||
When using the `namespaces` option, the discovered configuration object names will be suffixed as shown below:
|
||||
|
||||
```text
|
||||
<resource-name>@consul-<namespace>
|
||||
```
|
||||
|
||||
!!! warning
|
||||
|
||||
The namespace option only works with [Consul Enterprise](https://www.consul.io/docs/enterprise),
|
||||
The namespaces option only works with [Consul Enterprise](https://www.consul.io/docs/enterprise),
|
||||
which provides the [Namespaces](https://www.consul.io/docs/enterprise/namespaces) feature.
|
||||
|
||||
!!! warning
|
||||
|
||||
One should only define either the `namespaces` option or the `namespace` option.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
providers:
|
||||
consul:
|
||||
namespaces:
|
||||
- "ns1"
|
||||
- "ns2"
|
||||
# ...
|
||||
namespace: "production"
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[providers.consul]
|
||||
namespaces = ["ns1", "ns2"]
|
||||
# ...
|
||||
namespace = "production"
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--providers.consul.namespace=production
|
||||
--providers.consul.namespaces=ns1,ns2
|
||||
# ...
|
||||
```
|
||||
|
||||
### `username`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue