mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-31 17:28:13 +00:00
doc: added documentation for WAN service discovery
This commit is contained in:
@@ -61,8 +61,9 @@ client_key = "/etc/consul/consul-key.crt"
|
|||||||
tls_skip_verify = false
|
tls_skip_verify = false
|
||||||
tags = [ "dns-enabled" ]
|
tags = [ "dns-enabled" ]
|
||||||
meta = { dns-acl = "allow trusted" }
|
meta = { dns-acl = "allow trusted" }
|
||||||
|
# If your consul cluster is in a WAN configuration, you can provide the datacenter names to allow garage to do discovery across a WAN federation.
|
||||||
|
# This is not required for non-WAN consul instances.
|
||||||
|
# datacenters = ["dc1", "dc2", "dc3"]
|
||||||
[kubernetes_discovery]
|
[kubernetes_discovery]
|
||||||
namespace = "garage"
|
namespace = "garage"
|
||||||
service_name = "garage-daemon"
|
service_name = "garage-daemon"
|
||||||
@@ -127,12 +128,14 @@ The `[consul_discovery]` section:
|
|||||||
[`client_cert`](#consul_client_cert_and_key),
|
[`client_cert`](#consul_client_cert_and_key),
|
||||||
[`client_key`](#consul_client_cert_and_key),
|
[`client_key`](#consul_client_cert_and_key),
|
||||||
[`consul_http_addr`](#consul_http_addr),
|
[`consul_http_addr`](#consul_http_addr),
|
||||||
|
[`datacenters`](#consul_datacenters)
|
||||||
[`meta`](#consul_tags_and_meta),
|
[`meta`](#consul_tags_and_meta),
|
||||||
[`service_name`](#consul_service_name),
|
[`service_name`](#consul_service_name),
|
||||||
[`tags`](#consul_tags_and_meta),
|
[`tags`](#consul_tags_and_meta),
|
||||||
[`tls_skip_verify`](#consul_tls_skip_verify),
|
[`tls_skip_verify`](#consul_tls_skip_verify),
|
||||||
[`token`](#consul_token).
|
[`token`](#consul_token).
|
||||||
|
|
||||||
|
|
||||||
The `[kubernetes_discovery]` section:
|
The `[kubernetes_discovery]` section:
|
||||||
[`namespace`](#kube_namespace),
|
[`namespace`](#kube_namespace),
|
||||||
[`service_name`](#kube_service_name),
|
[`service_name`](#kube_service_name),
|
||||||
@@ -726,8 +729,15 @@ node_prefix "" {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `tags` and `meta` {#consul_tags_and_meta}
|
|
||||||
|
|
||||||
|
### `consul datacenters` {#consul_datacenters}
|
||||||
|
|
||||||
|
Optional list of datacenters that allow garage to do service discovery when consul is configured in WAN federation.
|
||||||
|
e.g datacenters = ["dc1", "dc2", "dc3"]
|
||||||
|
In a WAN configuration the consul services API only responds with local `LAN` services.
|
||||||
|
This queries the consul server API by datacenter directly, allowing for garage to discover nodes across consul WAN.
|
||||||
|
|
||||||
|
#### `tags` and `meta` {#consul_tags_and_meta}
|
||||||
Additional list of tags and map of service meta to add during service registration.
|
Additional list of tags and map of service meta to add during service registration.
|
||||||
|
|
||||||
### The `[kubernetes_discovery]` section
|
### The `[kubernetes_discovery]` section
|
||||||
|
|||||||
+11
-1
@@ -126,7 +126,17 @@ impl ConsulDiscovery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---- READING FROM CONSUL CATALOG ----
|
// ---- READING FROM CONSUL CATALOG ----
|
||||||
|
/// Query Consul for Garage nodes registered under the configured service name.
|
||||||
|
///
|
||||||
|
/// This method supports querying multiple Consul datacenters for WAN or
|
||||||
|
/// multi-datacenter deployments. If `config.datacenters` is set and non-empty,
|
||||||
|
/// each listed datacenter is queried and the results are aggregated. Otherwise,
|
||||||
|
/// only the local datacenter is queried. `config.datacenters` does not need to be set
|
||||||
|
/// when all the datacenters are on the same LAN, in this case service discovery works normally
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
/// A list of `(NodeID, SocketAddr)` pairs corresponding to all valid discovered
|
||||||
|
/// nodes across the queried datacenters.
|
||||||
pub async fn get_consul_nodes(&self) -> Result<Vec<(NodeID, SocketAddr)>, ConsulError> {
|
pub async fn get_consul_nodes(&self) -> Result<Vec<(NodeID, SocketAddr)>, ConsulError> {
|
||||||
let mut ret = vec![];
|
let mut ret = vec![];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user