Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 38 additions & 31 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ jobs:
- tests.all
- frr.dataplane
- dataplane
- validator
build:
- name: "debug"
profile: "debug"
Expand All @@ -151,29 +152,18 @@ jobs:
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: "login to image cache"
run: |
echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USERNAME" --password-stdin "$REGISTRY_URL"

# it's temporarily needed to install skopeo
- name: Setup Go
uses: actions/setup-go@v6
- name: "Install nix"
uses: cachix/install-nix-action@v31
with:
go-version: stable
cache: true
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixpkgs-unstable

- name: "Checkout"
uses: "actions/checkout@v6"
with:
persist-credentials: "false"
fetch-depth: "0"

- name: "Install nix"
uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixpkgs-unstable

- uses: "cachix/cachix-action@v17"
with:
name: "hedgehog"
Expand All @@ -182,6 +172,17 @@ jobs:
# prettier-ignore
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

# this step exists to avoid attributing the amount of time it takes to fetch the nix-shell dependencies to
# whatever step happens to access the nix-shell first.
- name: "setup nix shell"
run: |
nix-shell --run "echo nix shell env cached"

- name: "login to image cache"
run: |
docker login -u "$REGISTRY_USERNAME" --password-stdin "$REGISTRY_URL" <<<"${REGISTRY_PASSWORD}"
nix-shell --run "oras login -u \"$REGISTRY_USERNAME\" --password-stdin \"$REGISTRY_URL\" <<<\"${REGISTRY_PASSWORD}\""

- name: "run pre-flight checks"
if: ${{ matrix.nix-target == 'tests.all' }}
run: |
Expand All @@ -202,22 +203,28 @@ jobs:
- name: "push container"
if: ${{ matrix.nix-target != 'tests.all' }}
run: |
nix-shell --run "just \
debug_justfile=${{matrix.debug_justfile}} \
check-dependencies"
for v in "" "version=${{ needs.version.outputs.version }}-${{ matrix.build.profile }}"; do
nix-shell --run "
just \
docker_sock=/run/docker/docker.sock \
debug_justfile=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_justfile || false }} \
profile=${{ matrix.build.profile }} \
sanitize=${{ matrix.build.sanitize }} \
instrument=${{ matrix.build.instrument }} \
oci_repo=ghcr.io \
$v \
push-container ${{ matrix.nix-target }}
"
done
nix-shell --run '
just \
debug_justfile=${{matrix.debug_justfile}} \
check-dependencies
for v in "" "version=${{ needs.version.outputs.version }}-${{ matrix.build.profile }}"; do
if [ "${{ matrix.nix-target }}" = "validator" ]; then
platform="wasm32-wasip1"
else
platform="x86-64-v3"
fi
just \
docker_sock=/run/docker/docker.sock \
debug_justfile=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_justfile || false }} \
profile=${{ matrix.build.profile }} \
platform=${platform} \
sanitize=${{ matrix.build.sanitize }} \
instrument=${{ matrix.build.instrument }} \
oci_repo=ghcr.io \
$v \
push-container ${{ matrix.nix-target }}
done
'

- name: "Setup tmate session for debug"
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
Expand Down
37 changes: 15 additions & 22 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ dplane-rpc = { git = "https://github.com/githedgehog/dplane-rpc.git", rev = "e8f
errno = { path = "./errno", package = "dataplane-errno", features = [] }
flow-entry = { path = "./flow-entry", package = "dataplane-flow-entry", features = [] }
flow-filter = { path = "./flow-filter", package = "dataplane-flow-filter", features = [] }
hardware = { path = "./hardware", package = "dataplane-hardware", features = [] }
hardware = { path = "./hardware", package = "dataplane-hardware", default-features = false, features = [] }
id = { path = "./id", package = "dataplane-id", features = [] }
init = { path = "./init", package = "dataplane-init", features = [] }
interface-manager = { path = "./interface-manager", package = "dataplane-interface-manager", features = [] }
k8s-intf = { path = "./k8s-intf", package = "dataplane-k8s-intf", features = [] }
k8s-intf = { path = "./k8s-intf", package = "dataplane-k8s-intf", default-features = false, features = [] }
k8s-less = { path = "./k8s-less", package = "dataplane-k8s-less", features = [] }
left-right-tlcache = { path = "./left-right-tlcache", package = "dataplane-left-right-tlcache", features = [] }
lpm = { path = "./lpm", package = "dataplane-lpm", features = [] }
Expand Down Expand Up @@ -141,7 +141,7 @@ multi_index_map = { version = "0.15.1", default-features = false, features = []
n-vm = { git = "https://github.com/githedgehog/testn.git", tag = "v0.0.9", default-features = false, features = [], package = "n-vm" }
netdev = { version = "0.41.0", default-features = false, features = [] }
nix = { version = "0.31.2", default-features = false, features = [] }
netgauze-bgp-pkt = { version = "0.10.0", features = [] }
netgauze-bgp-pkt = { version = "0.10.0", features = [] }
netgauze-bmp-pkt = { version = "0.10.0", features = ["codec"] }
num-derive = { version = "0.4.2", default-features = false, features = [] }
num-traits = { version = "0.2.19", default-features = false, features = [] }
Expand Down Expand Up @@ -178,9 +178,9 @@ strum_macros = { version = "0.28.0", default-features = false, features = [] }
syn = { version = "2.0.117", default-features = false, features = [] }
thiserror = { version = "2.0.18", default-features = false, features = [] }
thread_local = { version = "1.1.9", default-features = false, features = [] }
tokio = { version = "1.50.0", default-features = false, features = ["rt-multi-thread"] }
tokio = { version = "1.50.0", default-features = false, features = [] }
tracing = { version = "0.1.44", default-features = false, features = [] }
tokio-util = { version = "0.7.18", default-features = false, features = ["codec"] }
tokio-util = { version = "0.7.18", default-features = false, features = [] }
tonic = { version = "0.14.5", default-features = false, features = [] }
tracing-error = { version = "0.2.1", default-features = false, features = [] }
tracing-subscriber = { version = "0.3.23", default-features = false, features = [] }
Expand Down
4 changes: 2 additions & 2 deletions args/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version.workspace = true

[dependencies]
# internal
hardware = { workspace = true, features = ["serde"] }
hardware = { workspace = true, features = ["serde", "sysfs"] }
id = { workspace = true, features = [] }
net = { workspace = true, features = [] }

Expand All @@ -27,7 +27,7 @@ uuid = { workspace = true, features = [] }

[dev-dependencies]
# internal
hardware = { workspace = true, features = ["serde"] }
hardware = { workspace = true, features = ["serde", "sysfs"] }
net = { workspace = true, features = ["test_buffer"] }
# external
serde_yaml_ng = { workspace = true, features = [] }
Expand Down
14 changes: 8 additions & 6 deletions config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,33 @@ version.workspace = true
# internal
common = { workspace = true }
hardware = { workspace = true }
k8s-intf = { workspace = true }
net = { workspace = true }
lpm = { workspace = true }
tracectl = { workspace = true }
k8s-intf = { workspace = true }

# external
arc-swap = { workspace = true }
chrono = { workspace = true, features = ["alloc", "std"] }
derive_builder = { workspace = true, default-features = false, features = ["default"] }
derive_builder = { workspace = true, features = [] }
ipnet = { workspace = true }
linkme = { workspace = true }
multi_index_map = { workspace = true, features = ["serde"] }
ordermap = { workspace = true, features = ["std"] }
thiserror = { workspace = true }
tracing = { workspace = true, features = ["attributes"] }

[target.'cfg(unix)'.dependencies]
linkme = { workspace = true }
tracectl = { workspace = true }

[dev-dependencies]
# internal
pipeline = { workspace = true } # should be removed w/ NAT
lpm = { workspace = true, features = ["testing"] }
hardware = { workspace = true, features = ["bolero"] }
hardware = { workspace = true, features = ["bolero", "sysfs"] }
k8s-intf = { workspace = true, features = ["bolero"] }

# external
bolero = { workspace = true, default-features = false, features = ["alloc"] }
bolero = { workspace = true, features = ["alloc"] }
caps = { workspace = true }
ipnet = { workspace = true }
pretty_assertions = { workspace = true, features = ["std"] }
3 changes: 3 additions & 0 deletions config/src/converters/k8s/config/tracecfg.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Open Network Fabric Authors

#[cfg(unix)]
use tracectl::LevelFilter;
#[cfg(not(unix))]
use tracing::metadata::LevelFilter;

use k8s_intf::gateway_agent_crd::GatewayAgentGatewayLogs;

Expand Down
2 changes: 1 addition & 1 deletion config/src/converters/k8s/status/bgp.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Open Network Fabric Authors

//! Converters for internal BGP status -> K8s GatewayAgentStatusStateBgp CRD.
//! Converters for internal BGP status -> K8s `GatewayAgentStatusStateBgp` CRD.

use std::collections::BTreeMap;

Expand Down
2 changes: 1 addition & 1 deletion config/src/converters/k8s/status/dataplane_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ mod tests {
let last_applied_time = time_gen.generate(d)?;
let status = d
.produce::<Option<LegalValue<DataplaneStatus>>>()?
.map(|v| v.take());
.map(LegalValue::take);
let last_collected_time_raw = time_gen.generate(d)?;
let last_collected_time = status.as_ref().map(|_| last_collected_time_raw);
let last_heartbeat_raw = time_gen.generate(d)?;
Expand Down
2 changes: 1 addition & 1 deletion config/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl Display for GwConfigMeta {
let error = self
.error
.as_ref()
.map_or("none".to_string(), |e| e.to_string());
.map_or("none".to_string(), std::string::ToString::to_string);

let is_rollback = if self.is_rollback { "(rollback)" } else { "" };

Expand Down
4 changes: 4 additions & 0 deletions config/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ pub enum ConfigError {
Invalid(String),

// tracing
#[cfg(unix)]
#[error("Failed to set tracing configuration: {0}")]
Tracing(#[from] tracectl::TraceCtlError),
#[cfg(not(unix))]
#[error("Failed to set tracing configuration: {0}")]
Tracing(String),

// Community mappings
#[error("Could not assign BGP community to VPC peering {0}")]
Expand Down
4 changes: 4 additions & 0 deletions config/src/external/communities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ impl PriorityCommunityTable {
Self::default()
}
/// Insert a community
///
/// # Errors
///
/// Returns [`ConfigError::DuplicateCommunity`] if the community already exists in the table.
pub fn insert(&mut self, order: usize, community: &str) -> Result<(), ConfigError> {
if self.0.iter().any(|(_, comm)| comm == community) {
return Err(ConfigError::DuplicateCommunity(community.to_string()));
Expand Down
Loading
Loading