From d781b58100feb39702dce77ad37638b8f0505948 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 1 Sep 2023 08:33:27 +0200 Subject: [PATCH] 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. --- .../dynamic-resource-allocation/controller/controller.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/staging/src/k8s.io/dynamic-resource-allocation/controller/controller.go b/staging/src/k8s.io/dynamic-resource-allocation/controller/controller.go index 38507391303..8deaf66f5bb 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/controller/controller.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/controller/controller.go @@ -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