Skip to content

Commit

Permalink
update deps to not use tonic 0.11 (#2798)
Browse files Browse the repository at this point in the history
* update deps to not use tonic 0.11

* changelog

* wrap tokio streams for hyper

* fix futureext import

* like this?

* use mereged containerd

* fix tokio io

* fix for real

* Cargo.toml comments
  • Loading branch information
t4lz authored Oct 7, 2024
1 parent 2aae35f commit 7fb6204
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 100 deletions.
126 changes: 32 additions & 94 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ private_intra_doc_links = "allow"
strip = "debuginfo"
# Enabling LTO causes this issue https://github.com/metalbear-co/mirrord/issues/906
lto = false

[patch.crates-io]
# Don't use tonic 0.11!
containerd-client = { git = "https://github.com/containerd/rust-extensions.git", package = "containerd-client" }
1 change: 1 addition & 0 deletions changelog.d/+update-tonic-deps.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dependency tree does not contain tonic 0.11.
5 changes: 3 additions & 2 deletions mirrord/agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# Don't use tonic 0.11! (patched in main Cargo.toml)
containerd-client = "0.5"
tokio = { workspace = true, features = [
"rt",
Expand Down Expand Up @@ -61,10 +62,10 @@ fancy-regex = { workspace = true }
dashmap = { version = "5" }
oci-spec = "0.6.0"
async-trait = "0.1"
tonic = "0.11"
tonic = "0.12"
tower = "0.4"
http = "1"
k8s-cri = "0.8"
k8s-cri = "0.9"
semver.workspace = true
tokio-rustls = "0.26"
x509-parser = "0.16"
Expand Down
9 changes: 8 additions & 1 deletion mirrord/agent/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ async fn connect(path: impl AsRef<std::path::Path>) -> ContainerRuntimeResult<Ch

Endpoint::try_from("http://localhost")
.map_err(ContainerRuntimeError::containerd)?
.connect_with_connector(service_fn(move |_: Uri| UnixStream::connect(path.clone())))
.connect_with_connector(service_fn(move |_: Uri| {
let path = path.clone();
async {
Ok::<_, std::io::Error>(hyper_util::rt::TokioIo::new(
UnixStream::connect(path).await?,
))
}
}))
.await
.map_err(ContainerRuntimeError::containerd)
}
Expand Down
9 changes: 6 additions & 3 deletions mirrord/agent/src/runtime/crio.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use futures::TryFutureExt;
use k8s_cri::v1::{runtime_service_client::RuntimeServiceClient, ContainerStatusRequest};
use serde::Deserialize;
use tokio::net::UnixStream;
Expand Down Expand Up @@ -31,8 +30,12 @@ impl ContainerRuntime for CriOContainer {
async fn get_info(&self) -> ContainerRuntimeResult<ContainerInfo> {
let channel = Endpoint::try_from("http://localhost")
.map_err(ContainerRuntimeError::crio)?
.connect_with_connector(service_fn(move |_: Uri| {
UnixStream::connect(CRIO_DEFAULT_SOCK_PATH).inspect_err(|err| error!("{err:?}"))
.connect_with_connector(service_fn(move |_: Uri| async {
Ok::<_, std::io::Error>(hyper_util::rt::TokioIo::new(
UnixStream::connect(CRIO_DEFAULT_SOCK_PATH)
.await
.inspect_err(|err| error!("{err:?}"))?,
))
}))
.await
.map_err(ContainerRuntimeError::crio)?;
Expand Down

0 comments on commit 7fb6204

Please sign in to comment.