DRA: Update resourceslice controller filtering logic

The logic has been updated to ensure that a controller started for
non-node-local resources filters out all resourceslices created for
node-local resources. Without this change, a single driver with both
node-local and non-node-local resources would end up in a constant
battle of creating and deleting node-local resource slices in the
controller it setup for its non-node-local resources. This change fixes
that.

Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
Kevin Klues 2024-10-11 12:25:22 +02:00
parent 426aa3d6ce
commit cfd6037b03

View File

@ -198,7 +198,10 @@ func (c *Controller) initInformer(ctx context.Context) error {
logger := klog.FromContext(ctx)
// We always filter by driver name, by node name only for node-local resources.
selector := fields.Set{resourceapi.ResourceSliceSelectorDriver: c.driver}
selector := fields.Set{
resourceapi.ResourceSliceSelectorDriver: c.driver,
resourceapi.ResourceSliceSelectorNodeName: "",
}
if c.owner.APIVersion == "v1" && c.owner.Kind == "Node" {
selector[resourceapi.ResourceSliceSelectorNodeName] = c.owner.Name
}