telekom / das-schiff-network-operator

Configure netlink interfaces, simple eBPF filters and FRR using Kubernetes resources.
Apache License 2.0
27 stars 3 forks source link

network-agent netns mode #122

Open chdxD1 opened 1 month ago

chdxD1 commented 1 month ago

Based on #121 (and the reason why we want to have the split).

This should be an alternative to the current "vrf-ibgp" (this is how I would call it today) mode. Either there will be a network-agent-netns and a network-agent-vrf-ibgp or it will be a network-agent with configuration flags. This is left for the implementor to decide.

The current network-operator architecture is based on some workarounds and is highly integrated into the host. This makes it complicated to make the network-operator useful for other people as well. It relies on VRFs which are connected by using veth interfaces in between.

Our goal is to move away from the veth interfaces between VRFs and to a traditional route-leaking setup.

The network-agent (in netns mode) would run in a network namespace / container (HBR container), completely separate from the Kubernetes side.

Currently the setup looks like this: VRFs:

image

Layer2s:

image

With this in mind it would end up like this:

image

This will require changes to the FRR templates (which I can provide, they do not need to be implemented here) and to the netlink interface.

Looking at the image above we focus on the two upper links: veth between node/HBR and veth Trunk.

We (for now) assume that there is an interface called hbn (attached to VRF hbr, also pre-created) inside the container and an interface called tr (not to be created by network-agent).

For VRFs network-agent must perform the following steps:

For Layer2s network-agent must perform the following steps:

For Layer2 there is an additional step where I am unsure where that could end up. There might be the need for a very small network-agent-host that creates the tr. interfaces on the host network namespace side, see picture above.

p-strusiewiczsurmacki-mobica commented 1 month ago

attach them to VRF hbr (default / main VRF) or a different VRF from above

How should it be decided which VRF to select?

p-strusiewiczsurmacki-mobica commented 1 month ago

@chdxD1 Hi, I've created branch with some changes here. https://github.com/p-strusiewiczsurmacki-mobica/das-schiff-network-operator/blob/agent-gradual-netns (this contains changes relevant to #110 #112 #121 as well).

I've separated the code that I think will be common for netns and vrf-ibgp modes in pkg/adapters/netlink.

For netns mode - in pkg/adapters/netns:

For VRFs (Layer 3):

For Layer2:

Currently I'm trying to figure out how to test this.

I have also some questions: