mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-09-08 04:58:16 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b795e38e9 |
Generated
+880
-901
File diff suppressed because it is too large
Load Diff
+1
-6
@@ -117,12 +117,7 @@ kube = { version = "3.0", default-features = false, features = [
|
|||||||
"rustls-tls",
|
"rustls-tls",
|
||||||
] }
|
] }
|
||||||
schemars = "1.2"
|
schemars = "1.2"
|
||||||
reqwest = { version = "0.13", default-features = false, features = [
|
reqwest = { version = "0.13", default-features = false }
|
||||||
"rustls-no-provider",
|
|
||||||
"json",
|
|
||||||
] }
|
|
||||||
rustls = { version = "0.23", default-features = false, features = ["std", "ring"] }
|
|
||||||
|
|
||||||
form_urlencoded = "1.2"
|
form_urlencoded = "1.2"
|
||||||
http = "1.4"
|
http = "1.4"
|
||||||
httpdate = "1.0"
|
httpdate = "1.0"
|
||||||
|
|||||||
@@ -47,10 +47,6 @@ bootstrap_peers = []
|
|||||||
$REPLICATION_MODE
|
$REPLICATION_MODE
|
||||||
rpc_secret = "$NETWORK_SECRET"
|
rpc_secret = "$NETWORK_SECRET"
|
||||||
|
|
||||||
[consul_discovery]
|
|
||||||
service_name = "panic-catcher"
|
|
||||||
consul_http_addr = "http://localhost:9876"
|
|
||||||
|
|
||||||
[s3_api]
|
[s3_api]
|
||||||
api_bind_addr = "0.0.0.0:$((3910+$count))" # the S3 API port, HTTP without TLS. Add a reverse proxy for the TLS part.
|
api_bind_addr = "0.0.0.0:$((3910+$count))" # the S3 API port, HTTP without TLS. Add a reverse proxy for the TLS part.
|
||||||
s3_region = "garage" # set this to anything. S3 API calls will fail if they are not made against the region set here.
|
s3_region = "garage" # set this to anything. S3 API calls will fail if they are not made against the region set here.
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ percent-encoding.workspace = true
|
|||||||
hyper = { workspace = true, default-features = false, features = ["http1", "http2"] }
|
hyper = { workspace = true, default-features = false, features = ["http1", "http2"] }
|
||||||
hyper-util.workspace = true
|
hyper-util.workspace = true
|
||||||
hyper-rustls.workspace = true
|
hyper-rustls.workspace = true
|
||||||
rustls.workspace = true
|
reqwest = { workspace = true, default-features = false, features = ["json", "rustls-no-provider"] }
|
||||||
serde = { workspace = true, default-features = false, features = ["derive", "std"] }
|
serde = { workspace = true, default-features = false, features = ["derive", "std"] }
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ impl K2vClient {
|
|||||||
/// Create a new K2V client.
|
/// Create a new K2V client.
|
||||||
pub fn new(config: K2vClientConfig) -> Result<Self, Error> {
|
pub fn new(config: K2vClientConfig) -> Result<Self, Error> {
|
||||||
let connector = hyper_rustls::HttpsConnectorBuilder::new()
|
let connector = hyper_rustls::HttpsConnectorBuilder::new()
|
||||||
.with_provider_and_native_roots(rustls::crypto::ring::default_provider())?
|
.with_native_roots()?
|
||||||
.https_or_http()
|
.https_or_http()
|
||||||
.enable_http1()
|
.enable_http1()
|
||||||
.enable_http2()
|
.enable_http2()
|
||||||
|
|||||||
+2
-6
@@ -40,11 +40,7 @@ thiserror = { workspace = true, optional = true }
|
|||||||
kube = { workspace = true, optional = true }
|
kube = { workspace = true, optional = true }
|
||||||
k8s-openapi = { workspace = true, optional = true }
|
k8s-openapi = { workspace = true, optional = true }
|
||||||
schemars = { workspace = true, optional = true }
|
schemars = { workspace = true, optional = true }
|
||||||
reqwest = { workspace = true, optional = true }
|
reqwest = { workspace = true, optional = true, features = ["json", "rustls"] }
|
||||||
hyper = { workspace = true, optional = true }
|
|
||||||
hyper-rustls = { workspace = true, optional = true }
|
|
||||||
hyper-util = { workspace = true, optional = true }
|
|
||||||
rustls = { workspace = true, optional = true }
|
|
||||||
|
|
||||||
pnet_datalink.workspace = true
|
pnet_datalink.workspace = true
|
||||||
|
|
||||||
@@ -54,7 +50,7 @@ opentelemetry.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
kubernetes-discovery = ["kube", "k8s-openapi", "schemars"]
|
kubernetes-discovery = ["kube", "k8s-openapi", "schemars"]
|
||||||
consul-discovery = ["hyper", "hyper-rustls", "hyper-util", "reqwest", "rustls", "thiserror"]
|
consul-discovery = ["reqwest", "thiserror"]
|
||||||
system-libs = ["sodiumoxide/use-pkg-config"]
|
system-libs = ["sodiumoxide/use-pkg-config"]
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ pub struct ConsulDiscovery {
|
|||||||
|
|
||||||
impl ConsulDiscovery {
|
impl ConsulDiscovery {
|
||||||
pub fn new(config: ConsulDiscoveryConfig) -> Result<Self, ConsulError> {
|
pub fn new(config: ConsulDiscoveryConfig) -> Result<Self, ConsulError> {
|
||||||
if rustls::crypto::CryptoProvider::get_default().is_none() {
|
|
||||||
_ = rustls::crypto::ring::default_provider().install_default();
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut builder: reqwest::ClientBuilder = reqwest::Client::builder().use_rustls_tls();
|
let mut builder: reqwest::ClientBuilder = reqwest::Client::builder().use_rustls_tls();
|
||||||
if config.tls_skip_verify {
|
if config.tls_skip_verify {
|
||||||
builder = builder.danger_accept_invalid_certs(true);
|
builder = builder.danger_accept_invalid_certs(true);
|
||||||
|
|||||||
+3
-10
@@ -29,15 +29,8 @@ pub struct Node {
|
|||||||
port: u16,
|
port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_client() -> Result<Client, kube::Error> {
|
|
||||||
if rustls::crypto::CryptoProvider::get_default().is_none() {
|
|
||||||
_ = rustls::crypto::ring::default_provider().install_default();
|
|
||||||
}
|
|
||||||
Client::try_default().await
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn create_kubernetes_crd() -> Result<(), kube::Error> {
|
pub async fn create_kubernetes_crd() -> Result<(), kube::Error> {
|
||||||
let client = get_client().await?;
|
let client = Client::try_default().await?;
|
||||||
let crds: Api<CustomResourceDefinition> = Api::all(client.clone());
|
let crds: Api<CustomResourceDefinition> = Api::all(client.clone());
|
||||||
|
|
||||||
let params = PatchParams::apply(&format!("garage.{}", K8S_GROUP));
|
let params = PatchParams::apply(&format!("garage.{}", K8S_GROUP));
|
||||||
@@ -52,7 +45,7 @@ pub async fn create_kubernetes_crd() -> Result<(), kube::Error> {
|
|||||||
pub async fn get_kubernetes_nodes(
|
pub async fn get_kubernetes_nodes(
|
||||||
kubernetes_config: &KubernetesDiscoveryConfig,
|
kubernetes_config: &KubernetesDiscoveryConfig,
|
||||||
) -> Result<Vec<(NodeID, SocketAddr)>, kube::Error> {
|
) -> Result<Vec<(NodeID, SocketAddr)>, kube::Error> {
|
||||||
let client = get_client().await?;
|
let client = Client::try_default().await?;
|
||||||
let nodes: Api<GarageNode> = Api::namespaced(client.clone(), &kubernetes_config.namespace);
|
let nodes: Api<GarageNode> = Api::namespaced(client.clone(), &kubernetes_config.namespace);
|
||||||
|
|
||||||
let lp = ListParams::default().labels(&format!(
|
let lp = ListParams::default().labels(&format!(
|
||||||
@@ -105,7 +98,7 @@ pub async fn publish_kubernetes_node(
|
|||||||
|
|
||||||
debug!("Node object to be applied: {:#?}", node);
|
debug!("Node object to be applied: {:#?}", node);
|
||||||
|
|
||||||
let client = get_client().await?;
|
let client = Client::try_default().await?;
|
||||||
let nodes: Api<GarageNode> = Api::namespaced(client.clone(), &kubernetes_config.namespace);
|
let nodes: Api<GarageNode> = Api::namespaced(client.clone(), &kubernetes_config.namespace);
|
||||||
|
|
||||||
if let Ok(old_node) = nodes.get(&node_pubkey).await {
|
if let Ok(old_node) = nodes.get(&node_pubkey).await {
|
||||||
|
|||||||
Reference in New Issue
Block a user