From dc8d93698b7e5bb8515aa2945a457da9c4f97a5e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 6 Jan 2026 14:32:07 +0100 Subject: [PATCH] small documentation fixes and simplify config struct --- doc/book/reference-manual/configuration.md | 27 ++++++++++++++-------- src/rpc/consul.rs | 2 +- src/util/config.rs | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/doc/book/reference-manual/configuration.md b/doc/book/reference-manual/configuration.md index fcf731e6..9b2d57b6 100644 --- a/doc/book/reference-manual/configuration.md +++ b/doc/book/reference-manual/configuration.md @@ -51,19 +51,21 @@ allow_punycode = false [consul_discovery] api = "catalog" -consul_http_addr = "http://127.0.0.1:8500" +consul_http_addr = "https://127.0.0.1:8500" +tls_skip_verify = false service_name = "garage-daemon" + ca_cert = "/etc/consul/consul-ca.crt" client_cert = "/etc/consul/consul-client.crt" client_key = "/etc/consul/consul-key.crt" + # for `agent` API mode, unset client_cert and client_key, and optionally enable `token` # token = "abcdef-01234-56789" -tls_skip_verify = false + tags = [ "dns-enabled" ] 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"] +datacenters = ["dc1", "dc2", "dc3"] + [kubernetes_discovery] namespace = "garage" service_name = "garage-daemon" @@ -730,14 +732,19 @@ node_prefix "" { ``` -### `consul datacenters` {#consul_datacenters} +#### `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. +Optional list of datacenters that allow garage to do service discovery when Consul is configured in WAN federation. + +Example: `datacenters = ["dc1", "dc2", "dc3"]` + +In a WAN configuration, by default the Consul services API only responds with +local LAN services. When a list of datacenters is specified using this option, +Garage will query the consul server API by datacenter directly, allowing for +Garage to discover nodes across the Consul WAN. #### `tags` and `meta` {#consul_tags_and_meta} + Additional list of tags and map of service meta to add during service registration. ### The `[kubernetes_discovery]` section diff --git a/src/rpc/consul.rs b/src/rpc/consul.rs index 54f75e74..f177ef95 100644 --- a/src/rpc/consul.rs +++ b/src/rpc/consul.rs @@ -141,7 +141,7 @@ impl ConsulDiscovery { let mut ret = vec![]; let dcs_to_query: Vec> = match &self.config.datacenters { - Some(dcs) if !dcs.is_empty() => dcs.iter().map(|dc| Some(dc.as_str())).collect(), + dcs if !dcs.is_empty() => dcs.iter().map(|dc| Some(dc.as_str())).collect(), _ => vec![None], }; diff --git a/src/util/config.rs b/src/util/config.rs index 29047f8c..83f07d03 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -258,7 +258,7 @@ pub struct ConsulDiscoveryConfig { #[serde(default)] pub meta: Option>, #[serde(default)] - pub datacenters: Option>, + pub datacenters: Vec, } #[derive(Deserialize, Debug, Clone)]