Skip to content

feat(nodeusbdevice): mirror usb attached condition#2221

Open
danilrwx wants to merge 1 commit intomainfrom
fix/usb/attached-nusb
Open

feat(nodeusbdevice): mirror usb attached condition#2221
danilrwx wants to merge 1 commit intomainfrom
fix/usb/attached-nusb

Conversation

@danilrwx
Copy link
Copy Markdown
Contributor

@danilrwx danilrwx commented Apr 15, 2026

Description

Add the Attached condition to NodeUSBDevice and mirror it from USBDevice.status.conditions[type=Attached].

The change also adds an Attached printer column for NodeUSBDevice, updates the controller to reconcile this condition, and adds a watcher so NodeUSBDevice is refreshed when the corresponding USBDevice changes.

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

NodeUSBDevice currently exposes only Ready and Assigned conditions, so it is not possible to tell from this resource whether the device is currently attached to a virtual machine.

The actual attachment state already exists in USBDevice, but it is inconvenient for cluster-level device visibility because NodeUSBDevice is the cluster-scoped source operators look at first.

This change makes NodeUSBDevice reflect the existing attachment state without introducing a second source of truth. The controller simply mirrors USBDevice.Attached status, reason, and message into NodeUSBDevice.Attached.

What is the expected result?

  1. Assign a NodeUSBDevice to a namespace.
  2. Before the device is attached to a VM, kubectl get nodeusbdevices shows Attached=False.
  3. Attach the corresponding USBDevice to a VirtualMachine.
  4. NodeUSBDevice.status.conditions[type=Attached] becomes True and the Attached printer column is updated.
  5. When the device is detached or temporarily unavailable for migration, NodeUSBDevice mirrors the corresponding USBDevice.Attached state and reason.

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: "Added the Attached condition and printer column to NodeUSBDevice by mirroring USBDevice attachment state."

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx added this to the v1.8.0 milestone Apr 15, 2026
@danilrwx danilrwx marked this pull request as ready for review April 15, 2026 15:59
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.

1 participant