Skip to content

Commit

Permalink
fix: initial reconcile should use client instead of cache
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Yu <jack.yu@suse.com>
  • Loading branch information
Yu-Jack committed Jul 11, 2024
1 parent 03dd2ef commit 27d9ea5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/usbdevice/usbdevice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ func (h *DevHandler) reconcile() error {
return err
}

storedUSBDevices, err := h.usbCache.List(labels.SelectorFromSet(cl.labels()))
list, err := h.usbClient.List(metav1.ListOptions{LabelSelector: labels.Set(cl.labels()).String()})
if err != nil {
logrus.Errorf("failed to list USB devices: %v\n", err)
return err
}

mapStoredUSBDevices := make(map[string]*v1beta1.USBDevice)
for _, storedUSBDevice := range storedUSBDevices {
for _, storedUSBDevice := range list.Items {
storedUSBDevice := storedUSBDevice
mapStoredUSBDevices[storedUSBDevice.Status.DevicePath] = storedUSBDevice
mapStoredUSBDevices[storedUSBDevice.Status.DevicePath] = &storedUSBDevice
}

err = h.handleList(h.getList(localUSBDevices, mapStoredUSBDevices, nodeName))
Expand Down

0 comments on commit 27d9ea5

Please sign in to comment.