Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AF_XDP examples #8984

Merged
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
78 changes: 78 additions & 0 deletions examples/afxdp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# AF_XDP forwarder-vpp management interface

Contains a setup for NSM that includes `nsmgr`, `forwarder-vpp`, `registry-k8s`, `admission-webhook`.
\
Unlike the [basic setup](../basic), which uses `AF_PACKET` management interface by default, we set `AF_XDP` here.

_**Note:** this is experimental feature. It may not work on some clusters._

The diagram below shows the movement of traffic within the forwarder-vpp:

![NSM kernel2kernel Diagram](./diagram.svg "NSM Kernel2Kernel Scheme")

Packets arriving at the network interface are processed by the eBPF program, which decides how to redirect the traffic.
If the packet belongs to the NSM interface it forwards it to the VPP, otherwise it goes to the Linux network stack.
## Requires

- [spire](../spire/single_cluster)

## Includes

- [Memif to Memif Connection](../use-cases/Memif2Memif)
- [Kernel to Kernel Connection](../use-cases/Kernel2Kernel)
- [Kernel to Memif Connection](../use-cases/Kernel2Memif)
- [Memif to Kernel Connection](../use-cases/Memif2Kernel)
- [Kernel to Ethernet to Kernel Connection](../use-cases/Kernel2Ethernet2Kernel)
- [Memif to Ethernet to Memif Connection](../use-cases/Memif2Ethernet2Memif)
- [Kernel to Ethernet to Memif Connection](../use-cases/Kernel2Ethernet2Memif)
- [Memif to Ethernet to Kernel Connection](../use-cases/Memif2Ethernet2Kernel)
- [Kernel to IP to Kernel Connection](../use-cases/Kernel2IP2Kernel)
- [Memif to IP to Memif Connection](../use-cases/Memif2IP2Memif)
- [Kernel to IP to Memif Connection](../use-cases/Kernel2IP2Memif)
- [Memif to IP to Kernel Connection](../use-cases/Memif2IP2Kernel)
- [Simple OPA example](../features/opa)
- [Kernel2Kernel IPv6 example](../features/ipv6/Kernel2Kernel_ipv6)
- [Memif2Memif IPv6 example](../features/ipv6/Memif2Memif_ipv6)
- [Kernel2IP2Kernel IPv6 example](../features/ipv6/Kernel2IP2Kernel_ipv6)
- [Kernel2IP2Memif IPv6 example](../features/ipv6/Kernel2IP2Memif_ipv6)
- [Memif2IP2Kernel IPv6 example](../features/ipv6/Memif2IP2Kernel_ipv6)
- [Memif2IP2Memif IPv6 example](../features/ipv6/Memif2IP2Memif_ipv6)
- [Kernel2Kernel dual stack example](../features/dual-stack/Kernel2Kernel_dual_stack)
- [Kernel2IP2Kernel dual stack example](../features/dual-stack/Kernel2IP2Kernel_dual_stack)
- [Admission webhook](../features/webhook)
- [DNS](../features/dns)
- [Topology aware scale from zero](../features/scale-from-zero)
- [NSE composition](../features/nse-composition)
- [Exclude prefixes](../features/exclude-prefixes)
- [Exclude prefixes client](../features/exclude-prefixes-client)
- [Policy based routing](../features/policy-based-routing)
- [Mutually aware NSEs](../features/mutually-aware-nses)
- [vL3-basic](../features/vl3-basic)
- [vL3 DNS](../features/vl3-dns)
- [vL3-scale-from-zero](../features/vl3-scale-from-zero)
- [Inject clients in namespace via NSM annotation](../features/annotated-namespace)

## Run

Apply NSM resources for basic tests:

```bash
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/afxdp?ref=335c3ef067cf7a8921a98d0cab3ef7e4220f3bcd
```

Wait for admission-webhook-k8s:

```bash
WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system
```

## Cleanup

To free resources follow the next commands:

```bash
WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
kubectl delete mutatingwebhookconfiguration ${WH}
kubectl delete ns nsm-system
```
4 changes: 4 additions & 0 deletions examples/afxdp/diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions examples/afxdp/forwarder-vpp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: forwarder-vpp
spec:
template:
spec:
containers:
- name: forwarder-vpp
env:
- name: NSM_VPP_INIT
value: AF_XDP
15 changes: 15 additions & 0 deletions examples/afxdp/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: nsm-system

resources:
- nsm-system-namespace.yaml
- ../../apps/nsmgr
- ../../apps/forwarder-vpp
- ../../apps/registry-k8s
- ../../apps/admission-webhook-k8s

patchesStrategicMerge:
- forwarder-vpp.yaml
5 changes: 5 additions & 0 deletions examples/afxdp/nsm-system-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: nsm-system