Skip to content

Request: Expose explicit SR-IOV PF/VF classification attributes in ResourceSlice #52

@kanlkan

Description

@kanlkan

Environment (Worker node)

  • OS: Ubuntu 24.04.3 LTS
  • Kernel: 6.8.0-90-generic
  • Kubernetes: v1.34.3
  • containerd: v2.1.6
  • DRANET: v1.0.1
  • SR-IOV NIC: Mellanox ConnectX-6
    • Create 2 VFs (ens1f0v0, ens1f0v1)

Details

dra.net/sriov and dra.net/virtual attributes for SR-IOV VFs in ResourceSlice are set to false.
Here is an example of Mellanox ConnectX-6 VFs in ResourceSlice.

...
  - attributes:
      dra.net/alias:
        string: ""
      dra.net/ebpf:
        bool: false
      dra.net/encapsulation:
        string: ether
      dra.net/ifName:
        string: ens1f0v0
      dra.net/mac:
        string: f6:f5:4b:8d:55:7c
      dra.net/mtu:
        int: 1500
      dra.net/numaNode:
        int: 0
      dra.net/pciAddress:
        string: "0000:27:00.2"
      dra.net/pciDevice:
        string: MT28908 Family [ConnectX-6 Virtual Function]
      dra.net/pciSubsystem:
        string: "0009"
      dra.net/pciVendor:
        string: Mellanox Technologies
      dra.net/rdma:
        bool: true
      dra.net/sriov:
        bool: false
      dra.net/state:
        string: down
      dra.net/type:
        string: device
      dra.net/virtual:
        bool: false
      resource.kubernetes.io/pcieRoot:
        string: pci0000:26
    name: pci-0000-27-00-2
  - attributes:
      dra.net/alias:
        string: ""
      dra.net/ebpf:
        bool: false
      dra.net/encapsulation:
        string: ether
      dra.net/ifName:
        string: ens1f0v1
      dra.net/mac:
        string: 32:f8:30:7f:45:51
      dra.net/mtu:
        int: 1500
      dra.net/numaNode:
        int: 0
      dra.net/pciAddress:
        string: "0000:27:00.3"
      dra.net/pciDevice:
        string: MT28908 Family [ConnectX-6 Virtual Function]
      dra.net/pciSubsystem:
        string: "0009"
      dra.net/pciVendor:
        string: Mellanox Technologies
      dra.net/rdma:
        bool: true
      dra.net/sriov:
        bool: false
      dra.net/state:
        string: down
      dra.net/type:
        string: device
      dra.net/virtual:
        bool: false
      resource.kubernetes.io/pcieRoot:
        string: pci0000:26
    name: pci-0000-27-00-3
...

I believe that dra.net/sriov means supporting sriov, and dra.net/virtual may depend on the netlink library.

I would like to filter only SR-IOV VFs devices by CEL expression in ResourceClaim or DeviceClass, with an easy-to-understand way, like the one below.

apiVersion: resource.k8s.io/v1
kind: ResourceClaim
metadata:
  name: sriov-vf1
spec:
  devices:
    requests:
    - name: sriov-vf
      exactly:
        deviceClassName: dranet
        count: 1
        selectors:
        - cel:
            expression: >
              device.attributes["dra.net"].isSriovVf == true

For now, I do it with the below, but it is a little tricky. It depends on how the Mellanox Driver is implemented.

apiVersion: resource.k8s.io/v1
kind: ResourceClaim
metadata:
  name: sriov-vf1
spec:
  devices:
    requests:
    - name: sriov-vfs
      exactly:
        deviceClassName: dranet
        count: 1
        selectors:
        - cel:
            expression: >
              device.attributes["dra.net"].pciDevice.contains("Virtual Function")

If DRANET agrees with my idea, I am willing to create a patch to achieve it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions