Skip to content

Instantly share code, notes, and snippets.

@anfredette
Last active January 22, 2025 15:25
Show Gist options
  • Save anfredette/4433aaa58518db5d4d14ed2bf4218f55 to your computer and use it in GitHub Desktop.
Save anfredette/4433aaa58518db5d4d14ed2bf4218f55 to your computer and use it in GitHub Desktop.
Output from new bpfman-operator

This the kubectl output from the initial implementation of the new bpfman-operator design intended to support the load/attach split.

The code currently only supports cluster-scoped XDP programs.

Add a program:

$ kubectl apply -f /home/afredette/go/src/github.com/bpfman/bpfman-operator/config/samples/bpfman.io_v1alpha1_bpfapplication.yaml
bpfapplication.bpfman.io/bpfapplication-sample created

Display objects:

$ kubectl get bpfapplications.bpfman.io 
NAME                    NODESELECTOR   STATUS             AGE
bpfapplication-sample   {}             ReconcileSuccess   2m29s
$ kubectl get bpfapplicationnodes.bpfman.io 
NAME                             NODE   STATUS             AGE
bpfapplication-sample-f4af8550          ReconcileSuccess   2m21s

bpfapplications.bpfman.io yaml output:

$ kubectl get bpfapplications.bpfman.io -o yaml
apiVersion: v1
items:
- apiVersion: bpfman.io/v1alpha1
  kind: BpfApplication
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"bpfman.io/v1alpha1","kind":"BpfApplication","metadata":{"annotations":{},"labels":{"app.kubernetes.io/name":"bpfapplication"},"name":"bpfapplication-sample"},"spec":{"bytecode":{"image":{"url":"quay.io/bpfman-bytecode/go-app-counter:latest"}},"nodeselector":{},"programs":{"xdp_stats":{"type":"XDP","xdp":{"attach_points":[{"interfaceselector":{"primarynodeinterface":true},"priority":55}],"bpffunctionname":"xdp_stats"}}}}}
    creationTimestamp: "2025-01-22T15:00:42Z"
    finalizers:
    - bpfman.io.operator/finalizer
    generation: 2
    labels:
      app.kubernetes.io/name: bpfapplication
    name: bpfapplication-sample
    resourceVersion: "12294"
    uid: b77799c7-793a-4885-b5dc-b96107419246
  spec:
    bytecode:
      image:
        imagepullpolicy: IfNotPresent
        url: quay.io/bpfman-bytecode/go-app-counter:latest
    nodeselector: {}
    programs:
      xdp_stats:
        type: XDP
        xdp:
          attach_points:
          - interfaceselector:
              primarynodeinterface: true
            priority: 55
            proceedon:
            - pass
            - dispatcher_return
          bpffunctionname: xdp_stats
          oldmapownerselector: {}
  status:
    conditions:
    - lastTransitionTime: "2025-01-22T15:00:57Z"
      message: bpfProgramReconciliation Succeeded on all nodes
      reason: ReconcileSuccess
      status: "True"
      type: ReconcileSuccess
kind: List
metadata:
  resourceVersion: ""

bpfapplicationnodes.bpfman.io yaml output:

$ kubectl get bpfapplicationnodes.bpfman.io -o yaml
apiVersion: v1
items:
- apiVersion: bpfman.io/v1alpha1
  kind: BpfApplicationNode
  metadata:
    creationTimestamp: "2025-01-22T15:00:56Z"
    finalizers:
    - bpfman.io.bpfapplicationcontroller/finalizer
    generation: 1
    labels:
      bpfman.io/ownedByProgram: bpfapplication-sample
      kubernetes.io/hostname: bpfman-deployment-control-plane
    name: bpfapplication-sample-f4af8550
    ownerReferences:
    - apiVersion: bpfman.io/v1alpha1
      blockOwnerDeletion: true
      controller: true
      kind: BpfApplication
      name: bpfapplication-sample
      uid: b77799c7-793a-4885-b5dc-b96107419246
    resourceVersion: "12293"
    uid: 6db6d372-b40b-4b85-8b29-52f4348f046a
  spec:
    apploadstatus: Loaded
    programs:
      xdp_stats:
        programattachstatus: Attached
        type: XDP
        xdp:
          attach_points:
          - attachid: 2955
            attachstatus: Attached
            ifname: eth0
            priority: 55
            proceedon:
            - pass
            - dispatcher_return
            should_attach: true
            uuid: 8c6be4f4-7216-4abf-83e0-296610fa2e91
    updatecount: 1
  status:
    conditions:
    - lastTransitionTime: "2025-01-22T15:00:57Z"
      message: bpfProgramReconciliation Succeeded on all nodes
      reason: ReconcileSuccess
      status: "True"
      type: ReconcileSuccess
kind: List
metadata:
  resourceVersion: ""

Delete BpfApplication:

$ kubectl delete -f /home/afredette/go/src/github.com/bpfman/bpfman-operator/config/samples/bpfman.io_v1alpha1_bpfapplication.yaml
bpfapplication.bpfman.io "bpfapplication-sample" deleted
$ kubectl get bpfapplications.bpfman.io
No resources found
$ kubectl get bpfapplicationnodes.bpfman.io
No resources found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment