Skip to content

Commit

Permalink
Return reconcile error if node state is not updated
Browse files Browse the repository at this point in the history
NetFilter selector depends on PCI address of NICs from the node state.
After PR k8snetworkplumbingwg#487 is merged we need to check if node state is updated
or return an reconcile error to render device plugin config faster.
  • Loading branch information
e0ne committed Aug 14, 2023
1 parent 7b5ecac commit fd0737a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controllers/sriovnetworknodepolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,9 @@ func createDevicePluginResource(
// Enable the selection of devices using NetFilter
if p.Spec.NicSelector.NetFilter != "" {
// Loop through interfaces status to find a match for NetworkID or NetworkTag
if len(nodeState.Status.Interfaces) == 0 {
return nil, fmt.Errorf("node state %s doesn't contain interfaces data", nodeState.Name)
}
for _, intf := range nodeState.Status.Interfaces {
if sriovnetworkv1.NetFilterMatch(p.Spec.NicSelector.NetFilter, intf.NetFilter) {
// Found a match add the Interfaces PciAddress
Expand Down

0 comments on commit fd0737a

Please sign in to comment.