diff --git a/dataplane/Cargo.toml b/dataplane/Cargo.toml index c15780a1..2bbf231e 100644 --- a/dataplane/Cargo.toml +++ b/dataplane/Cargo.toml @@ -1,2 +1,6 @@ [workspace] members = ["api-server", "loader", "common", "xtask"] + +[patch.crates-io] +aya = { git = "https://github.com/aya-rs/aya", branch="main" } +aya-log = { git = "https://github.com/aya-rs/aya", branch = "main" } diff --git a/dataplane/api-server/Cargo.toml b/dataplane/api-server/Cargo.toml index 7c504005..94c5e467 100644 --- a/dataplane/api-server/Cargo.toml +++ b/dataplane/api-server/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] prost = "0.11.9" -tonic = "0.8.3" +tonic = "0.9.2" anyhow = "1" log = "0.4" aya = { version = ">=0.11", features=["async_tokio"] } @@ -16,4 +16,4 @@ regex = "1" libc = "0.2" [build-dependencies] -tonic-build = "0.8.4" +tonic-build = "0.9.2" diff --git a/dataplane/api-server/src/lib.rs b/dataplane/api-server/src/lib.rs index aa29d37f..83cccc2f 100644 --- a/dataplane/api-server/src/lib.rs +++ b/dataplane/api-server/src/lib.rs @@ -5,7 +5,7 @@ pub mod server; use std::net::{Ipv4Addr, SocketAddrV4}; use anyhow::Error; -use aya::maps::{HashMap, MapRefMut}; +use aya::maps::{HashMap, MapData}; use tonic::transport::Server; use backends::backends_server::BackendsServer; @@ -14,7 +14,7 @@ use common::{Backend, BackendKey}; pub async fn start( addr: Ipv4Addr, port: u16, - bpf_map: HashMap, + bpf_map: HashMap, ) -> Result<(), Error> { let server = server::BackendService::new(bpf_map); // TODO: mTLS https://github.com/Kong/blixt/issues/50 diff --git a/dataplane/api-server/src/server.rs b/dataplane/api-server/src/server.rs index 54f1d432..9388103c 100644 --- a/dataplane/api-server/src/server.rs +++ b/dataplane/api-server/src/server.rs @@ -2,7 +2,7 @@ use std::net::Ipv4Addr; use std::sync::Arc; use anyhow::Error; -use aya::maps::{HashMap, MapRefMut}; +use aya::maps::{HashMap, MapData}; use tokio::sync::Mutex; use tonic::{Request, Response, Status}; @@ -12,11 +12,11 @@ use crate::netutils::{if_name_for_routing_ip, if_nametoindex}; use common::{Backend, BackendKey}; pub struct BackendService { - bpf_map: Arc>>, + bpf_map: Arc>>, } impl BackendService { - pub fn new(bpf_map: HashMap) -> BackendService { + pub fn new(bpf_map: HashMap) -> BackendService { BackendService { bpf_map: Arc::new(Mutex::new(bpf_map)), } diff --git a/dataplane/loader/Cargo.toml b/dataplane/loader/Cargo.toml index 5107ec3a..881cf3a7 100644 --- a/dataplane/loader/Cargo.toml +++ b/dataplane/loader/Cargo.toml @@ -8,8 +8,8 @@ publish = false aya = { version = ">=0.11", features=["async_tokio"] } aya-log = "0.1" common = { path = "../common", features=["user"] } -clap = { version = "3.2", features = ["derive"] } -env_logger = "0.9" +clap = { version = "4.4", features = ["derive"] } +env_logger = "0.10" log = "0.4" tokio = { version = "1.32.0", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } api-server = { path = "../api-server" } diff --git a/dataplane/loader/src/main.rs b/dataplane/loader/src/main.rs index 0ea18577..be2b8da4 100644 --- a/dataplane/loader/src/main.rs +++ b/dataplane/loader/src/main.rs @@ -55,7 +55,8 @@ async fn main() -> Result<(), anyhow::Error> { .context("failed to attach the egress TC program")?; info!("starting api server"); - let backends: HashMap<_, BackendKey, Backend> = HashMap::try_from(bpf.map_mut("BACKENDS")?)?; + let backends: HashMap<_, BackendKey, Backend> = + HashMap::try_from(bpf.take_map("BACKENDS").expect("no maps named BACKENDS"))?; start_api_server(Ipv4Addr::new(0, 0, 0, 0), 9874, backends).await?; info!("Exiting..."); diff --git a/dataplane/xtask/Cargo.toml b/dataplane/xtask/Cargo.toml index 9765a84e..5b94259d 100644 --- a/dataplane/xtask/Cargo.toml +++ b/dataplane/xtask/Cargo.toml @@ -6,11 +6,11 @@ edition = "2021" [dependencies] anyhow = "1" aya-tool = { git = "https://github.com/aya-rs/aya", branch = "main" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.4", features = ["derive"] } prost = "0.11.9" tokio = { version = "1.32.0", features = ["macros", "rt-multi-thread"] } -tonic = "0.8.3" +tonic = "0.9.2" api-server = { path = "../api-server" } [build-dependencies] -tonic-build = "0.8.4" +tonic-build = "0.9.2"