diff options
author | Alex <alex@adnab.me> | 2022-10-18 20:20:55 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2022-10-18 20:20:55 +0000 |
commit | 52547506586c10cd8200fbdf6112dd53663e5200 (patch) | |
tree | 3ea0cd34ae65c037ebb51a35fd83c71912f2c9e2 /src/util/config.rs | |
parent | 5670599372f6c3c60dcd74279a0741248fc510c3 (diff) | |
parent | 57b5c2c754a8d6d55882eae3dad44e328d961084 (diff) | |
download | garage-0.8-rc2.tar.gz garage-0.8-rc2.zip |
Merge pull request 'Add TLS support for Consul discovery + refactoring' (#405) from consul-tls into mainv0.8.0-rc2v0.8-rc2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/405
Diffstat (limited to 'src/util/config.rs')
-rw-r--r-- | src/util/config.rs | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/src/util/config.rs b/src/util/config.rs index 2d4b4f57..04f8375a 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -46,20 +46,17 @@ pub struct Config { /// Timeout for Netapp RPC calls pub rpc_timeout_msec: Option<u64>, + // -- Bootstraping and discovery /// Bootstrap peers RPC address #[serde(default)] pub bootstrap_peers: Vec<String>, - /// Consul host to connect to to discover more peers - pub consul_host: Option<String>, - /// Consul service name to use - pub consul_service_name: Option<String>, - /// Kubernetes namespace the service discovery resources are be created in - pub kubernetes_namespace: Option<String>, - /// Service name to filter for in k8s custom resources - pub kubernetes_service_name: Option<String>, - /// Skip creation of the garagenodes CRD + + /// Configuration for automatic node discovery through Consul #[serde(default)] - pub kubernetes_skip_crd: bool, + pub consul_discovery: Option<ConsulDiscoveryConfig>, + /// Configuration for automatic node discovery through Kubernetes + #[serde(default)] + pub kubernetes_discovery: Option<KubernetesDiscoveryConfig>, // -- DB /// Database engine to use for metadata (options: sled, sqlite, lmdb) @@ -129,6 +126,34 @@ pub struct AdminConfig { pub trace_sink: Option<String>, } +#[derive(Deserialize, Debug, Clone)] +pub struct ConsulDiscoveryConfig { + /// Consul http or https address to connect to to discover more peers + pub consul_http_addr: String, + /// Consul service name to use + pub service_name: String, + /// CA TLS certificate to use when connecting to Consul + pub ca_cert: Option<String>, + /// Client TLS certificate to use when connecting to Consul + pub client_cert: Option<String>, + /// Client TLS key to use when connecting to Consul + pub client_key: Option<String>, + /// Skip TLS hostname verification + #[serde(default)] + pub tls_skip_verify: bool, +} + +#[derive(Deserialize, Debug, Clone)] +pub struct KubernetesDiscoveryConfig { + /// Kubernetes namespace the service discovery resources are be created in + pub namespace: String, + /// Service name to filter for in k8s custom resources + pub service_name: String, + /// Skip creation of the garagenodes CRD + #[serde(default)] + pub skip_crd: bool, +} + fn default_db_engine() -> String { "sled".into() } |