dra scheduler: fix re-allocation of claim with structured parameters

The code was incorrectly checking for a controller, but only the boolean
is set for allocated claims. As a result, deallocation was requested from
a non-existent control plane controller.

While at it, let's also clear the driver name. It's not needed when the
claim is deallocated.
This commit is contained in:
Patrick Ohly 2024-03-22 08:10:18 +01:00
parent cf8fffae72
commit 95136db063

View File

@ -1209,7 +1209,7 @@ func (pl *dynamicResources) PostFilter(ctx context.Context, cs *framework.CycleS
// Then we can simply clear the allocation. Once the // Then we can simply clear the allocation. Once the
// claim informer catches up, the controllers will // claim informer catches up, the controllers will
// be notified about this change. // be notified about this change.
clearAllocation := state.informationsForClaim[index].controller != nil clearAllocation := state.informationsForClaim[index].structuredParameters
// Before we tell a driver to deallocate a claim, we // Before we tell a driver to deallocate a claim, we
// have to stop telling it to allocate. Otherwise, // have to stop telling it to allocate. Otherwise,
@ -1228,6 +1228,7 @@ func (pl *dynamicResources) PostFilter(ctx context.Context, cs *framework.CycleS
claim := claim.DeepCopy() claim := claim.DeepCopy()
claim.Status.ReservedFor = nil claim.Status.ReservedFor = nil
if clearAllocation { if clearAllocation {
claim.Status.DriverName = ""
claim.Status.Allocation = nil claim.Status.Allocation = nil
} else { } else {
claim.Status.DeallocationRequested = true claim.Status.DeallocationRequested = true