Merge pull request #123938 from pohly/dra-structured-parameters-tests

DRA: test for structured parameters
This commit is contained in:
Kubernetes Prow Robot
2024-04-18 02:10:08 -07:00
committed by GitHub
10 changed files with 2623 additions and 59 deletions

View File

@@ -1218,7 +1218,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,
@@ -1237,6 +1237,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
@@ -1419,7 +1420,11 @@ func (pl *dynamicResources) Reserve(ctx context.Context, cs *framework.CycleStat
}
state.informationsForClaim[index].allocation = allocation
state.informationsForClaim[index].allocationDriverName = driverName
// Strictly speaking, we don't need to store the full modified object.
// The allocation would be enough. The full object is useful for
// debugging and testing, so let's make it realistic.
claim = claim.DeepCopy()
claim.Finalizers = append(claim.Finalizers, resourcev1alpha2.Finalizer)
claim.Status.DriverName = driverName
claim.Status.Allocation = allocation
pl.inFlightAllocations.Store(claim.UID, claim)