forked from Deuxfleurs/garage
allow additional ServiceMeta, docs
This commit is contained in:
parent
7e78e6298f
commit
dbc05ab96f
3 changed files with 28 additions and 9 deletions
|
@ -42,6 +42,17 @@ client_cert = "/etc/consul/consul-client.crt"
|
|||
client_key = "/etc/consul/consul-key.crt"
|
||||
tls_skip_verify = false
|
||||
|
||||
[consul_service_discovery]
|
||||
consul_http_addr = "https://127.0.0.1:8501"
|
||||
consul_http_token = "abcdef-01234-56789"
|
||||
service_name = "garage"
|
||||
ca_cert = "/etc/consul/consul-ca.crt"
|
||||
tls_skip_verify = false
|
||||
# tags to add to the published service
|
||||
tags = [ "dns-enabled" ]
|
||||
# additional service meta to send along registration
|
||||
meta = { dns-acl = "allow trusted" }
|
||||
|
||||
[kubernetes_discovery]
|
||||
namespace = "garage"
|
||||
service_name = "garage-daemon"
|
||||
|
|
|
@ -129,17 +129,22 @@ impl ConsulServiceDiscovery {
|
|||
]
|
||||
.concat();
|
||||
|
||||
let mut meta = HashMap::from([
|
||||
(format!("{}-pubkey", META_PREFIX), hex::encode(node_id)),
|
||||
(format!("{}-hostname", META_PREFIX), hostname.to_string()),
|
||||
]);
|
||||
|
||||
if let Some(global_meta) = &self.config.meta {
|
||||
for (key, value) in global_meta.into_iter() {
|
||||
meta.insert(key.clone(), value.clone());
|
||||
}
|
||||
}
|
||||
|
||||
let advertisement: ConsulPublishService = ConsulPublishService {
|
||||
service_id: node.clone(),
|
||||
service_name: self.config.service_name.clone(),
|
||||
tags,
|
||||
meta: [
|
||||
(format!("{}-pubkey", META_PREFIX), hex::encode(node_id)),
|
||||
(format!("{}-hostname", META_PREFIX), hostname.to_string()),
|
||||
]
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect(),
|
||||
meta,
|
||||
address: rpc_public_addr.ip(),
|
||||
port: rpc_public_addr.port(),
|
||||
};
|
||||
|
|
|
@ -168,6 +168,9 @@ pub struct ConsulServiceConfig {
|
|||
// Additional tags to add to the service
|
||||
#[serde(default)]
|
||||
pub tags: Vec<String>,
|
||||
// Additional service metadata to add
|
||||
#[serde(default)]
|
||||
pub meta: Option<std::collections::HashMap<String, String>>,
|
||||
/// Skip TLS hostname verification
|
||||
#[serde(default)]
|
||||
pub tls_skip_verify: bool,
|
||||
|
|
Loading…
Reference in a new issue