Skip to content

Instantly share code, notes, and snippets.

$ kubectl explain clusterbpfapplication
GROUP: bpfman.io
KIND: ClusterBpfApplication
VERSION: v1alpha1
DESCRIPTION:
ClusterBpfApplication is the schema for the cluster scoped BPF Applications
API. Using this API allows applications to load one or more eBPF programs on
a Kubernetes cluster using bpfman to load the programs.

Using Operator-SDK v1.27.0 (from Makefile at the time)

Goal is to run ./bin/operator-sdk create api --kind TcxNsProgram ... to add a new kind object. As is, can't run in our repo without hitting errors.

Run Command

$ ./bin/operator-sdk create api --group bpfman --version v1alpha1 --kind TcxNsProgram --resource --controller --force --namespaced=true
Error: failed to create API: unable to inject the resource to "base.go.kubebuilder.io/v3": multiple groups are not allowed by default, to enable multi-group visit https://kubebuilder.io/migration/multi-group.html
BROKEN first, then WORKS after
-------------
BROKEN
-------------
# From main:latest
$ sudo /usr/share/bcc/tools/capable
TIME UID PID COMM CAP NAME AUDIT

bpfd Test Notes

nginx server

Start nginx server in a container:

docker run --name my-nginx -p 80:80 -d nginx

docker ps
 CONTAINER ID   IMAGE     COMMAND                  CREATED       STATUS       PORTS                               NAMES
# NOTES:
# Used `/usr/share/bcc/tools/capable` to view the capabilities being used while performing
# the following bpfd actions:
# sudo systemctl start bpfd.service
# bpfctl list
# bpfctl load
# bpfctl unload
# gocounter <-- Reads Maps
# unload gocounter
# sudo systemctl stop bpfd.service

Multiple Active Gateways

Summary

Submariner currently only allows a single gateway to be active at any one time in a given cluster. This enhancement proposes that there be an option to allow more than one gateway to be active in a given cluster to enhance both performance and resiliency. This feature is sometimes referred to as “active-active gateways”; however, the goal is to allow two or more active gateways to be used.

Proposal

journalctl --since "1 hour ago"
-- Logs begin at Mon 2021-03-01 05:44:38 UTC, end at Wed 2021-03-03 21:46:40 UTC. --
Mar 03 20:46:42 worker-advnetlab52 hyperkube[4431]: I0303 20:46:42.174321 4431 kuberuntime_manager.go:439] No sandbox for pod "dns-default-zz4cg_openshift-dns(2894274c-9163-477e-b5ae-f39051b38f6b)" can be found. Need to start a new one
Mar 03 20:46:42 worker-advnetlab52 crio[4383]: time="2021-03-03 20:46:42.174690940Z" level=info msg="Running pod sandbox: openshift-dns/dns-default-zz4cg/POD" id=d3c5e0a3-7baf-4767-a293-d09de144db5c name=/runtime.v1alpha2.RuntimeService/RunPodSandbox
Mar 03 20:46:42 worker-advnetlab52 crio[4383]: time="2021-03-03 20:46:42.186367685Z" level=info msg="Got pod network &{Name:dns-default-zz4cg Namespace:openshift-dns ID:5963e8dee48ec49f6cf983785c9861b77df0fe85eaa1eb366a5fc49ed97f6f4f NetNS:/var/run/netns/c47775b3-293e-4734-b6d9->
Mar 03 20:46:42 worker-advnetlab52 crio[4383]: time="2021-03-03 20:46:42.186399601Z" level=info msg="About to add CNI network multus-cn
$ git diff pkg/types/conf.go
diff --git a/pkg/types/conf.go b/pkg/types/conf.go
index b0ca491..2420c67 100644
--- a/pkg/types/conf.go
+++ b/pkg/types/conf.go
@@ -143,10 +143,13 @@ func LoadDelegateNetConf(bytes []byte, net *NetworkSelectionElement, deviceID st
}
// mergeCNIRuntimeConfig creates CNI runtimeconfig from delegate
-func mergeCNIRuntimeConfig(runtimeConfig *RuntimeConfig, delegate *DelegateNetConf) *RuntimeConfig {
apiVersion: v1
kind: Pod
metadata:
name: sriov-pod-1
annotations:
k8s.v1.cni.cncf.io/networks: sriov-net-a, sriov-net-b
spec:
containers:
- name: sriov-example
image: dpdk-app-centos:latest