Skip to content
Merged
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
58 changes: 58 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)

This product includes cryptographic software written by Eric Young ([email protected])
1 change: 1 addition & 0 deletions config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ tracectl = { workspace = true }
k8s-intf = { workspace = true }

# external
chrono = { workspace = true }
derive_builder = { workspace = true, default-features = false, features = ["default"] }
ipnet = { workspace = true }
linkme = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use k8s_intf::gateway_agent_crd::{
};
use lpm::prefix::{Prefix, PrefixString};

use crate::converters::k8s::{FromK8sConversionError, SubnetMap};
use crate::converters::k8s::FromK8sConversionError;
use crate::converters::k8s::config::SubnetMap;
use crate::external::overlay::vpcpeering::VpcExpose;

fn process_ip_block(
Expand Down
24 changes: 24 additions & 0 deletions config/src/converters/k8s/config/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Open Network Fabric Authors

//! Converter for gateway-schema k8s objects to internal config

#![deny(clippy::all, clippy::pedantic)]

pub mod bgp;
pub mod device;
pub mod expose;
pub mod gateway_config;
pub mod interface;
pub mod overlay;
pub mod peering;
pub mod tracecfg;
pub mod underlay;
pub mod vpc;

use std::collections::BTreeMap;

use lpm::prefix::Prefix;

pub type SubnetMap = BTreeMap<String, Prefix>;
pub type VpcSubnetMap = BTreeMap<String, SubnetMap>;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use std::collections::BTreeMap;
use k8s_intf::gateway_agent_crd::{GatewayAgentPeerings, GatewayAgentSpec, GatewayAgentVpcs};
use lpm::prefix::Prefix;

use crate::converters::k8s::{FromK8sConversionError, SubnetMap, VpcSubnetMap};
use crate::converters::k8s::FromK8sConversionError;
use crate::converters::k8s::config::{SubnetMap, VpcSubnetMap};
use crate::external::overlay::Overlay;
use crate::external::overlay::vpc::{Vpc, VpcTable};
use crate::external::overlay::vpcpeering::{VpcPeering, VpcPeeringTable};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

use k8s_intf::gateway_agent_crd::{GatewayAgentPeerings, GatewayAgentPeeringsPeering};

use crate::converters::k8s::{FromK8sConversionError, SubnetMap, VpcSubnetMap};
use crate::converters::k8s::FromK8sConversionError;
use crate::converters::k8s::config::{SubnetMap, VpcSubnetMap};
use crate::external::overlay::vpcpeering::{VpcExpose, VpcManifest, VpcPeering};

impl TryFrom<(&SubnetMap, &str, &GatewayAgentPeeringsPeering)> for VpcManifest {
Expand Down Expand Up @@ -68,7 +69,7 @@ mod test {
};
use lpm::prefix::Prefix;

use crate::converters::k8s::{SubnetMap, VpcSubnetMap};
use crate::converters::k8s::config::{SubnetMap, VpcSubnetMap};

#[test]
fn test_vpc_manifest_conversion() {
Expand Down
23 changes: 3 additions & 20 deletions config/src/converters/k8s/mod.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Open Network Fabric Authors

//! Converter for gateway-schema k8s objects to internal config
//! Converter for gateway-schema k8s objects to internal config and status

#![deny(clippy::all, clippy::pedantic)]

pub mod bgp;
pub mod device;
pub mod expose;
pub mod gateway_config;
pub mod interface;
pub mod overlay;
pub mod peering;
pub mod tracecfg;
pub mod underlay;
pub mod vpc;

use std::collections::BTreeMap;
pub mod config;
pub mod status;

use thiserror::Error;

use lpm::prefix::Prefix;

#[derive(Debug, Error)]
pub enum FromK8sConversionError {
#[error("Invalid Gateway Agent object: {0}")]
Expand All @@ -45,6 +31,3 @@ pub enum ToK8sConversionError {
#[error("Source configuration cannot be converted: {0}")]
Unsupported(String),
}

pub type SubnetMap = BTreeMap<String, Prefix>;
pub type VpcSubnetMap = BTreeMap<String, SubnetMap>;
Loading