Skip to content

Commit

Permalink
Add ExcludeNUMATopology to node policy
Browse files Browse the repository at this point in the history
Add field `SriovNetworkNodePolicy.Spec.ExcludeNUMATopology` and
forward it to the sriov-device-plugin configuration.

Signed-off-by: Andrea Panattoni <[email protected]>
  • Loading branch information
zeeke committed May 8, 2023
1 parent 17bf75a commit aaf9c47
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/v1/sriovnetworknodepolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type SriovNetworkNodePolicySpec struct {
// +kubebuilder:validation:Enum=virtio
// VDPA device type. Allowed value "virtio"
VdpaType string `json:"vdpaType,omitempty"`
// Exclude device's NUMA node when advertising this resource. Default to false.
ExcludeNUMATopology bool `json:"excludeTopology,omitempty"`
}

type SriovNetworkNicSelector struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ spec:
- legacy
- switchdev
type: string
excludeTopology:
description: Exclude device's NUMA node when advertising this resource.
Default to false.
type: boolean
isRdma:
description: RDMA mode. Defaults to false.
type: boolean
Expand Down
4 changes: 4 additions & 0 deletions controllers/sriovnetworknodepolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,8 @@ func createDevicePluginResource(
rawNetDeviceSelectors := json.RawMessage(netDeviceSelectorsMarshal)
rc.Selectors = &rawNetDeviceSelectors

rc.ExcludeTopology = p.Spec.ExcludeNUMATopology

return rc, nil
}

Expand Down Expand Up @@ -758,5 +760,7 @@ func updateDevicePluginResource(
rawNetDeviceSelectors := json.RawMessage(netDeviceSelectorsMarshal)
rc.Selectors = &rawNetDeviceSelectors

rc.ExcludeTopology = p.Spec.ExcludeNUMATopology

return nil
}
18 changes: 18 additions & 0 deletions controllers/sriovnetworknodepolicy_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,24 @@ func TestRenderDevicePluginConfigData(t *testing.T) {
},
},
},
{
tname: "testExcludeNUMATopology",
policy: sriovnetworkv1.SriovNetworkNodePolicy{
Spec: v1.SriovNetworkNodePolicySpec{
ResourceName: "resourceName",
ExcludeNUMATopology: true,
},
},
expResource: dptypes.ResourceConfList{
ResourceList: []dptypes.ResourceConfig{
{
ResourceName: "resourceName",
Selectors: mustMarshallSelector(t, &dptypes.NetDeviceSelectors{}),
ExcludeTopology: true,
},
},
},
},
}

reconciler := SriovNetworkNodePolicyReconciler{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ spec:
- legacy
- switchdev
type: string
excludeTopology:
description: Exclude device's NUMA node when advertising this resource.
Default to false.
type: boolean
isRdma:
description: RDMA mode. Defaults to false.
type: boolean
Expand Down

0 comments on commit aaf9c47

Please sign in to comment.