Skip to content

Commit 848f491

Browse files
Remove redundant clientutil usage
As the `List` call explicitly uses the `InNamespace` option, there is no need for using the `clientutil` package in this case.
1 parent 68b99b4 commit 848f491

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

internal/controller/core/device_controller.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,8 @@ func (r *DeviceReconciler) reconcile(ctx context.Context, device *v1alpha1.Devic
241241
return fmt.Errorf("failed to list device ports: %w", err)
242242
}
243243

244-
c := clientutil.NewClient(r.Client, device.Namespace)
245-
246244
interfaces := new(v1alpha1.InterfaceList)
247-
if err := c.List(ctx, interfaces, client.InNamespace(device.Namespace), client.MatchingLabels{v1alpha1.DeviceLabel: device.Name}); err != nil {
245+
if err := r.List(ctx, interfaces, client.InNamespace(device.Namespace), client.MatchingLabels{v1alpha1.DeviceLabel: device.Name}); err != nil {
248246
return fmt.Errorf("failed to list interface resources for device: %w", err)
249247
}
250248

0 commit comments

Comments
 (0)