dra helper: skip allocated claims during UnsuitableNodes calculation

The UnsuitableNodes interface method was defined as getting passed only
unallocated claims, but was implemented so that it also included allocated
claims with delayed allocation.

This had two negative consequences:
- When the test driver checked whether all claims fit onto a node,
  it incorrectly rejected a node where, for example, one out of
  two claims was already allocated and the pending one would have
  fit. This caused random flakes in the scheduler_perf benchmark
  because those tests fill up the entire cluster and, depending on
  timing, sometimes not all claims got allocated at once.
- If the class or parameters for an allocated claim got deleted,
  UnsuitableNodes failed although those are not needed anymore
  after allocation.
This commit is contained in:
Patrick Ohly 2023-09-01 08:33:27 +02:00
parent 6eca142082
commit d781b58100

View File

@ -661,6 +661,11 @@ func (ctrl *controller) checkPodClaim(ctx context.Context, pod *v1.Pod, podClaim
// Nothing to do for it as part of pod scheduling.
return nil, nil
}
if claim.Status.Allocation != nil {
// Already allocated, class and parameter are not needed and nothing
// need to be done for the claim either.
return nil, nil
}
class, err := ctrl.rcLister.Get(claim.Spec.ResourceClassName)
if err != nil {
return nil, err