Skip to content

Conversation

@danilrwx
Copy link
Contributor

@danilrwx danilrwx commented Jan 23, 2026

Description

Added a new CRD NodeUSBDevice and controller for managing USB devices at the node level in the cluster.

Main components:

  1. NodeUSBDevice CRD (crds/nodeusbdevices.yaml):

    • A namespace-scoped resource representing a USB device discovered on a specific node
    • Contains device attributes (vendorID, productID, bus, deviceNumber, serial, manufacturer, product, etc.)
    • Supports two condition types:
      • Ready - device readiness for use
      • Assigned - namespace assignment for the device
  2. NodeUSBDevice Controller (images/virtualization-artifact/pkg/controller/nodeusbdevice/):

    • DiscoveryHandler: Automatically discovers USB devices from ResourceSlice (created by DRA system) and creates corresponding NodeUSBDevice resources
    • ReadyHandler: Checks device presence in ResourceSlice and updates the Ready condition
    • AssignedHandler: Manages namespace assignment via spec.assignedNamespace and automatically creates/deletes corresponding USBDevice resources in the specified namespace
    • DeletionHandler: Handles resource deletion
  3. DRA Integration:

    • Controller watches ResourceSlice with driver virtualization-dra
    • Devices are identified by name prefix usb-
    • Unique device identification uses a hash calculated based on main device attributes
  4. USBDevice Relationship:

    • When spec.assignedNamespace is set, the controller automatically creates a USBDevice resource in the specified namespace
    • When namespace is changed or cleared, the corresponding USBDevice is deleted

Why do we need it, and what problem does it solve?

The DRA (Dynamic Resource Allocation) system automatically discovers USB devices on cluster nodes and creates ResourceSlice resources. However, there was no convenient mechanism for managing these devices at the Kubernetes level:

  • No way to see all USB devices discovered on cluster nodes in a unified view
  • No ability to assign devices to specific namespaces for use in virtual machines
  • No automatic synchronization between devices on nodes and USBDevice resources in namespaces

Solution:

NodeUSBDevice provides an abstraction layer between physical USB devices on nodes (represented via ResourceSlice) and logical USBDevice resources in namespaces. This enables:

  • Administrators to see all available USB devices in the cluster via kubectl get nodeusbdevices
  • Assigning devices to specific namespaces by setting spec.assignedNamespace
  • Automatic creation of USBDevice resources in namespaces upon assignment, simplifying device usage in virtual machines

What is the expected result?

  • NodeUSBDevice resources are automatically created for all USB devices discovered by the DRA system
  • The Ready condition correctly reflects device presence on the node
  • When assignedNamespace is set, a USBDevice is automatically created in the specified namespace
  • When assignedNamespace is changed or cleared, corresponding USBDevice resources are correctly deleted
  • All device attributes (vendorID, productID, manufacturer, product, etc.) are correctly synchronized from ResourceSlice

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: api
type: feature
summary: Add NodeUSBDevice and USBDevice.

@danilrwx danilrwx changed the base branch from main to feat/dra-usbip January 23, 2026 16:52
@danilrwx danilrwx force-pushed the feat/node-usb-device branch from 29be831 to b276ce0 Compare January 23, 2026 16:57
@danilrwx danilrwx changed the base branch from feat/dra-usbip to feat/dra-hotplug-claims January 23, 2026 16:57
@danilrwx danilrwx changed the base branch from feat/dra-hotplug-claims to feat/dra January 23, 2026 16:57
@danilrwx danilrwx changed the base branch from feat/dra to feat/dra-usbip January 23, 2026 16:58
@danilrwx danilrwx force-pushed the feat/node-usb-device branch from b276ce0 to 9b7436f Compare January 23, 2026 16:58
@danilrwx danilrwx added this to the v1.6.0 milestone Jan 26, 2026
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the feat/node-usb-device branch from 7fa6900 to 64d1d94 Compare January 26, 2026 15:42
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the feat/node-usb-device branch from 3639c3b to 13711f9 Compare January 27, 2026 12:54
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the feat/node-usb-device branch from 13711f9 to 0471614 Compare January 27, 2026 13:14
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the feat/node-usb-device branch from d520f2d to b08c106 Compare January 27, 2026 23:20
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
This reverts commit ec89273.

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants