From 002b9fc50c5b69e0e10c84e4db5ecea1b3941fad Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 18 Oct 2022 18:38:20 +0200 Subject: Add TLS support for Consul discovery + refactoring --- src/util/config.rs | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'src/util') diff --git a/src/util/config.rs b/src/util/config.rs index 2d4b4f57..a85e025f 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, + // -- Bootstraping and discovery /// Bootstrap peers RPC address #[serde(default)] pub bootstrap_peers: Vec, - /// Consul host to connect to to discover more peers - pub consul_host: Option, - /// Consul service name to use - pub consul_service_name: Option, - /// Kubernetes namespace the service discovery resources are be created in - pub kubernetes_namespace: Option, - /// Service name to filter for in k8s custom resources - pub kubernetes_service_name: Option, - /// Skip creation of the garagenodes CRD + + /// Configuration for automatic node discovery through Consul + #[serde(default)] + pub consul_discovery: Option, + /// Configuration for automatic node discovery through Kubernetes #[serde(default)] - pub kubernetes_skip_crd: bool, + pub kubernetes_discovery: Option, // -- DB /// Database engine to use for metadata (options: sled, sqlite, lmdb) @@ -129,6 +126,34 @@ pub struct AdminConfig { pub trace_sink: Option, } +#[derive(Deserialize, Debug, Clone)] +pub struct ConsulDiscoveryConfig { + /// Consul host to connect to to discover more peers + pub consul_host: String, + /// Consul service name to use + pub service_name: String, + /// CA TLS certificate to use when connecting to Consul + pub ca_cert: Option, + /// Client TLS certificate to use when connecting to Consul + pub client_cert: Option, + /// Client TLS key to use when connecting to Consul + pub client_key: Option, + /// 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() } -- cgit v1.2.3