From 95136db063a48d5da88b749842becea557d5b4f2 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 22 Mar 2024 08:10:18 +0100 Subject: [PATCH] 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. --- .../framework/plugins/dynamicresources/dynamicresources.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go index 449b24b5f56..0ca0e2de18a 100644 --- a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go +++ b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go @@ -1209,7 +1209,7 @@ func (pl *dynamicResources) PostFilter(ctx context.Context, cs *framework.CycleS // Then we can simply clear the allocation. Once the // claim informer catches up, the controllers will // 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 // 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.Status.ReservedFor = nil if clearAllocation { + claim.Status.DriverName = "" claim.Status.Allocation = nil } else { claim.Status.DeallocationRequested = true