Skip to content

Commit

Permalink
feat: add header for mirror mode (#644)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
gaius-qi authored Aug 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0bc8ce9 commit aee6a66
Showing 3 changed files with 22 additions and 17 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ members = [
]

[workspace.package]
version = "0.1.92"
version = "0.1.93"
authors = ["The Dragonfly Developers"]
homepage = "https://d7y.io/"
repository = "https://github.com/dragonflyoss/client.git"
@@ -22,13 +22,13 @@ readme = "README.md"
edition = "2021"

[workspace.dependencies]
dragonfly-client = { path = "dragonfly-client", version = "0.1.92" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.92" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.92" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.92" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.92" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.92" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.92" }
dragonfly-client = { path = "dragonfly-client", version = "0.1.93" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.93" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.93" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.93" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.93" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.93" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.93" }
thiserror = "1.0"
dragonfly-api = "2.0.141"
reqwest = { version = "0.12.4", features = ["stream", "native-tls", "default-tls", "rustls-tls"] }
7 changes: 6 additions & 1 deletion dragonfly-client-init/src/container_runtime/containerd.rs
Original file line number Diff line number Diff line change
@@ -204,11 +204,16 @@ impl Containerd {
// Add endpoints to the mirror configuration.
let mut endpoints = Array::default();
endpoints.push(Value::from(proxy_config.addr.clone()));
endpoints.push(Value::from(registry.server_addr));
endpoints.push(Value::from(registry.server_addr.clone()));

let mut mirror_table = Table::new();
mirror_table.insert("endpoint", value(endpoints));

// Add X-Dragonfly-Registry header to the mirror configuration.
let mut headers_table = Table::new();
headers_table.insert(DRAGONFLY_REGISTRY_HEADER, value(registry.server_addr));
mirror_table.insert("header", Item::Table(headers_table));

mirrors_table.insert(&registry.host_namespace, Item::Table(mirror_table));
}

0 comments on commit aee6a66

Please sign in to comment.