Skip to content

Commit

Permalink
Readme: cleanup and update for bpfd v0.3.0
Browse files Browse the repository at this point in the history
Signed-off-by: Maryam Tahhan <[email protected]>
  • Loading branch information
maryamtahhan committed Nov 3, 2023
1 parent 17a3c6d commit b47ded1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ kind-load-images: ## Load the image on the kind cluster
@echo
@echo

# make KIND_CLUSTER_NAME=bpfd-deployment IMAGE=quay.io/mtahhan/cndp-map-pinning kind-load-custom-image
.PHONY: kind-load-custom-image
kind-load-custom-image: ## Load the image on the kind cluster
@echo "****** Loading ${IMAGE} ******"
Expand Down Expand Up @@ -273,17 +272,15 @@ kind-deploy: kind-undeploy kind-load-images ## Deploy the Deamonset and CNI in K
@echo
@echo

# make KIND_CLUSTER_NAME=bpfd-deployment kind-undeploy-bpfd
kind-undeploy-bpfd: ## Undeploy the Kind Deamonset
kind-undeploy-bpfd: ## Undeploy the Kind Deamonset in a bpfd cluster
@echo "****** Stop Daemonset ******"
@echo
kubectl delete -f ./deployments/daemonset-kind-bpfd.yaml --ignore-not-found=true
@echo
@echo

# make KIND_CLUSTER_NAME=bpfd-deployment kind-deploy-bpfd
.PHONY: kind-deploy-bpfd
kind-deploy-bpfd: kind-undeploy-bpfd kind-load-images ## Deploy the Deamonset and CNI in the Kind
kind-deploy-bpfd: kind-undeploy-bpfd kind-load-images ## Deploy the Kind Deamonset in a bpfd cluster
@echo "****** Deploy Daemonset ******"
@echo
kubectl create -f ./deployments/daemonset-kind-bpfd.yaml
Expand Down
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ The following prerequisites are required to run the plugins:
- To use a Kind deployment.
- [Kind quickstart guide](https://kind.sigs.k8s.io/docs/user/quick-start/)
- Tested with Kind version 0.18.0
- **Note:** For kind, please also install [**kubeadm**](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- **Note:** For Kind, please also install [**kubeadm**](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- **Note:** For Kind, please use docker to build images.

### Development Prerequisites

Expand Down Expand Up @@ -545,11 +546,25 @@ From the [examples/network-attachment-definition.yaml](./examples/network-attach
bpfd is a system daemon aimed at simplifying the deployment and management of eBPF programs. Integrating the AF_XDP
device plugin with bpfd means delegating the responsibility of loading and unloading the eBPF programs for AF_XDP applications
to the bpfd daemonset running on each node. This means that instead of AF_XDP DP loading/unloading a BPF program, it will create/delete
an [XdpProgram CRD](https://pkg.go.dev/github.com/bpfd-dev/bpfd@v0.2.1/bpfd-operator/apis/v1alpha1#XdpProgram) via the
[bpfd-operator APIs](https://pkg.go.dev/github.com/bpfd-dev/bpfd@v0.2.1/bpfd-operator/apis/v1alpha1).
an [XdpProgram CRD](https://pkg.go.dev/github.com/bpfd-dev/bpfd@v0.3.0/bpfd-operator/apis/v1alpha1#XdpProgram) via the
[bpfd-operator APIs](https://pkg.go.dev/github.com/bpfd-dev/bpfd@v0.3.0/bpfd-operator/apis/v1alpha1).

More info about bpfd can be found [here](https://bpfd.dev/#challenges-for-ebpf-in-kubernetes).

Assuming a bpfd (Kind) cluster is deployed, AF_XDP DP can be deployed in that cluster by issuing the following commands:

```bash
#!/bin/bash
make docker
docker pull quay.io/mtahhan/cndp-map-pinning:latest
docker pull quay.io/mtahhan/xsk_def_xdp_prog:latest
make setup-multus
make KIND_CLUSTER_NAME=bpfd-deployment kind-label-bpfd-cp
make KIND_CLUSTER_NAME=bpfd-deployment IMAGE=quay.io/mtahhan/cndp-map-pinning kind-load-custom-image
make KIND_CLUSTER_NAME=bpfd-deployment IMAGE=quay.io/mtahhan/xsk_def_xdp_prog kind-load-custom-image
make KIND_CLUSTER_NAME=bpfd-deployment kind-deploy-bpfd
```

#### AF_XDP Bytecode image

bpfd works with eBPF Bytecode packaged in an OCI compliant image. More info on this can be found
Expand All @@ -561,24 +576,22 @@ that holds the AF_XDP bpf program bytecode. An example of such a program exists
https://github.com/bpfd-dev/bpfd.git
```

And build docker image that specifies the `PROGRAM_TYPE`, `BYTECODE_FILENAME`, `SECTION_NAME` and `KERNEL_COMPILE_VER`.
And build docker image that specifies the `PROGRAM_TYPE`, `BPF_FUNCTION_NAME`, `PROGRAM_NAME` ,`BYTECODE_FILENAME`, `SECTION_NAME` and `KERNEL_COMPILE_VER`.

For example for the default AF_XDP eBPF program from xdp-tools [xsk_def_xdp_prog.c](https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/xsk_def_xdp_prog.c)

```bash
docker build --build-arg PROGRAM_NAME=xsk_def_xdp_prog --build-arg PROGRAM_TYPE=xdp --build-arg BYTECODE_FILENAME=xsk_def_xdp_prog.o --build-arg SECTION_NAME=xsk_def_prog --build-arg KERNEL_COMPILE_VER=$(uname -r) -f packaging/container-deployment/Containerfile.bytecode /$PATH_TO_XDP_TOOLS/xdp-tools/lib/libxdp -t quay.io/$USER/xsk_def_xdp_prog:latest
docker build --build-arg PROGRAM_NAME=xsk_def_xdp_prog --build-arg BPF_FUNCTION_NAME=xsk_def_prog --build-arg PROGRAM_TYPE=xdp --build-arg BYTECODE_FILENAME=xsk_def_xdp_prog.o --build-arg KERNEL_COMPILE_VER=$(uname -r) -f packaging/container-deployment/Containerfile.bytecode /$PATH_TO_XDP_TOOLS/xdp-tools/lib/libxdp -t quay.io/$USER/xsk_def_xdp_prog:latest
```

Two pool configuration parameters have been added to allow the specification of the default OCI bytecode image and section to use,
Two pool configuration parameters have been added to allow the specification of the OCI bytecode image and section to use,
an example is shown below:

```yaml
"bpfByteCodeImage": "quay.io/bpfd-bytecode/go-xdp-counter",
"bpfByteCodeFunction": "xdp_stats",
"BpfByteCodeImage": "quay.io/mtahhan/xsk_def_xdp_prog:latest",
"BpfByteCodeFunction": "xsk_def_prog",
```

In the future, we would like to make the eBPF program/bytecode selection configurable via pod annotation.

#### DPCNIServer

The bpfd integration and map pinning support in the DP introduced the need for a syncronization call from the CNI to the DP in order
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/bpfd-dev/bpfd v0.3.0
github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.1.1
github.com/distribution/reference v0.5.0
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
github.com/golang/protobuf v1.5.3
github.com/google/gofuzz v1.2.0
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/digitalocean/godo v1.65.0/go.mod h1:p7dOjjtSBqCTUksqtA5Fd3uaKs9kyTq2xcz76ulEJRU=
github.com/distribution/distribution/v3 v3.0.0-20210804104954-38ab4c606ee3/go.mod h1:gt38b7cvVKazi5XkHvINNytZXgTEntyhtyM3HQz46Nk=
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/cli v20.10.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
Expand Down Expand Up @@ -1392,7 +1390,6 @@ github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
Expand Down

0 comments on commit b47ded1

Please sign in to comment.