Skip to content

Commit

Permalink
bump deps update loader for aya:main
Browse files Browse the repository at this point in the history
bump deps so build-ebpf doesn't fail + bump all deps that had
more recent versions, like tonic clap etc.

make sure to run `cargo install bpf-linker` locally to ensure
that its up to date.

use the `take_map` aya API to take ownership of the CONNTRACK map before
passing it to our "api-server".

Signed-off-by: astoycos <[email protected]>
  • Loading branch information
astoycos authored and shaneutt committed Sep 1, 2023
1 parent 2b5755b commit e41e047
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
4 changes: 4 additions & 0 deletions dataplane/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
4 changes: 2 additions & 2 deletions dataplane/api-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -16,4 +16,4 @@ regex = "1"
libc = "0.2"

[build-dependencies]
tonic-build = "0.8.4"
tonic-build = "0.9.2"
4 changes: 2 additions & 2 deletions dataplane/api-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,7 +14,7 @@ use common::{Backend, BackendKey};
pub async fn start(
addr: Ipv4Addr,
port: u16,
bpf_map: HashMap<MapRefMut, BackendKey, Backend>,
bpf_map: HashMap<MapData, BackendKey, Backend>,
) -> Result<(), Error> {
let server = server::BackendService::new(bpf_map);
// TODO: mTLS https://github.com/Kong/blixt/issues/50
Expand Down
6 changes: 3 additions & 3 deletions dataplane/api-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -12,11 +12,11 @@ use crate::netutils::{if_name_for_routing_ip, if_nametoindex};
use common::{Backend, BackendKey};

pub struct BackendService {
bpf_map: Arc<Mutex<HashMap<MapRefMut, BackendKey, Backend>>>,
bpf_map: Arc<Mutex<HashMap<MapData, BackendKey, Backend>>>,
}

impl BackendService {
pub fn new(bpf_map: HashMap<MapRefMut, BackendKey, Backend>) -> BackendService {
pub fn new(bpf_map: HashMap<MapData, BackendKey, Backend>) -> BackendService {
BackendService {
bpf_map: Arc::new(Mutex::new(bpf_map)),
}
Expand Down
4 changes: 2 additions & 2 deletions dataplane/loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
3 changes: 2 additions & 1 deletion dataplane/loader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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...");
Expand Down
6 changes: 3 additions & 3 deletions dataplane/xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit e41e047

Please sign in to comment.