bpfman / bpfman-operator

Kubernetes operator for bpfman
https://bpfman.io
Apache License 2.0
3 stars 5 forks source link

Develop a more concise naming scheme for BpfPrograms #28

Open anfredette opened 2 weeks ago

anfredette commented 2 weeks ago

The names are currently very long. For example:

$ kubectl get bpfprograms.bpfman.io 
NAME                                                                                                               TYPE          STATUS         AGE
bpfapplication-sample-kprobe-try-to-wake-up-bpfman-deployment-control-plane-try-to-wake-up                         application   bpfmanLoaded   109s
bpfapplication-sample-tc-ingress-eth0-bpfman-deployment-control-plane-eth0                                         application   bpfmanLoaded   104s
bpfapplication-sample-tracepoint-syscalls-sys-enter-kill-bpfman-deployment-control-plane-syscalls-sys-enter-kill   application   bpfmanLoaded   106s
bpfapplication-sample-uprobe-malloc-bpfman-deployment-control-plane-libc-bpfman-daemon-wbktz-bpfman                application   bpfmanLoaded   97s
bpfapplication-sample-uprobe-malloc-bpfman-deployment-control-plane-libc-bpfman-daemon-wbktz-bpfman-agent          application   bpfmanLoaded   100s
bpfapplication-sample-xdp-eth0-bpfman-deployment-control-plane-eth0                                                application   bpfmanLoaded   94s
kprobe-example-bpfman-deployment-control-plane-try-to-wake-up                                                      kprobe        bpfmanLoaded   69s
tc-pass-all-nodes-bpfman-deployment-control-plane-eth0                                                             tc            bpfmanLoaded   28s
tracepoint-example-bpfman-deployment-control-plane-syscalls-sys-enter-openat                                       tracepoint    bpfmanLoaded   28s
uprobe-example-bpfman-deployment-control-plane-libc                                                                uprobe        bpfmanLoaded   58s
uprobe-example-containers-bpfman-deployment-control-plane-libc-bpfman-daemon-wbktz-bpfman                          uprobe        bpfmanLoaded   43s
uprobe-example-containers-bpfman-deployment-control-plane-libc-bpfman-daemon-wbktz-bpfman-agent                    uprobe        bpfmanLoaded   50s
xdp-pass-all-nodes-bpfman-deployment-control-plane-eth0                                                            xdp                          18s

We need a way to uniquely and deterministically determine the names of the BpfProgram objects created on a given node resulting from a given *Program or BpfApplication CRD. The bpfman agent controller uses this name to compare the existing programs (getExistingBpfPrograms()) to the expected programs (getExpectedBpfPrograms()) during a reconcile pass.

An idea is to create a name for the BpfProgram object based on the *Program or BpfApplication CRD name plus a randomly generated string, and then save a longer unique and deterministic string used for comparisons and lists.

anfredette commented 5 days ago

Here's the new output:


$ kubectl get bpfprograms.bpfman.io 
NAME                                        TYPE          STATUS         AGE
bpfapplication-sample-kprobe-e9584268       application   bpfmanLoaded   6m31s
bpfapplication-sample-tc-5c64641c           application   bpfmanLoaded   6m24s
bpfapplication-sample-tracepoint-1f1a61a1   application   bpfmanLoaded   6m26s
bpfapplication-sample-uprobe-72e8858d       application   bpfmanLoaded   5m9s
bpfapplication-sample-uprobe-b4fde6c2       application   bpfmanLoaded   5m1s
bpfapplication-sample-xdp-f3ef4383          application   bpfmanLoaded   4m53s
fentry-example-cd940fa0                     fentry        bpfmanLoaded   5m20s
fexit-example-fd53742b                      fexit         bpfmanLoaded   6m20s
kprobe-example-f24ff1d3                     kprobe        bpfmanLoaded   6m11s
tc-pass-all-nodes-563ab6b1                  tc            bpfmanLoaded   5m51s
tracepoint-example-4a04a14a                 tracepoint    bpfmanLoaded   6m1s
uprobe-example-17e5ab9b                     uprobe        bpfmanLoaded   5m30s
uprobe-example-containers-9412fff0          uprobe        bpfmanLoaded   5m23s
uprobe-example-containers-d6b84e71          uprobe        bpfmanLoaded   5m26s
xdp-pass-all-nodes-c6626947                 xdp           bpfmanLoaded   5m40s```