diff --git a/pkg/controller/queuejob/queuejob_controller_ex.go b/pkg/controller/queuejob/queuejob_controller_ex.go index 009192998..a064141cc 100644 --- a/pkg/controller/queuejob/queuejob_controller_ex.go +++ b/pkg/controller/queuejob/queuejob_controller_ex.go @@ -1029,6 +1029,8 @@ func (qjm *XController) chooseAgent(qj *arbv1.AppWrapper) string { //Now evaluate quota if qjm.serverOption.QuotaEnabled { if qjm.quotaManager != nil { + //quota trees faile to update with AW deletes, release quota before assigning + qjm.quotaManager.Release(qj) if fits, preemptAWs, _ := qjm.quotaManager.Fits(qj, qjAggrResources, proposedPreemptions); fits { klog.V(2).Infof("[chooseAgent] AppWrapper %s has enough quota.\n", qj.Name) qjm.preemptAWJobs(preemptAWs) @@ -1267,7 +1269,9 @@ func (qjm *XController) ScheduleNext() { if qjm.quotaManager != nil { var msg string var preemptAWs []*arbv1.AppWrapper - quotaFits, preemptAWs, msg = qjm.quotaManager.Fits(qj, aggqj, proposedPreemptions) + //quota trees fail to update with AW deletes, release quota before assigning + qjm.quotaManager.Release(qj) + quotaFits, preemptAWs, msg := qjm.quotaManager.Fits(qj, aggqj, proposedPreemptions) if quotaFits { klog.Infof("[ScheduleNext] HOL quota evaluation successful %s for %s activeQ=%t Unsched=%t &qj=%p Version=%s Status=%+v due to quota limits", qj.Name, time.Now().Sub(HOLStartTime), qjm.qjqueue.IfExistActiveQ(qj), qjm.qjqueue.IfExistUnschedulableQ(qj), qj, qj.ResourceVersion, qj.Status) // Set any jobs that are marked for preemption diff --git a/pkg/quotaplugins/quota-forest/quota-manager/quota/quotamanager.go b/pkg/quotaplugins/quota-forest/quota-manager/quota/quotamanager.go index a5f5ee8b4..36b1dceb2 100644 --- a/pkg/quotaplugins/quota-forest/quota-manager/quota/quotamanager.go +++ b/pkg/quotaplugins/quota-forest/quota-manager/quota/quotamanager.go @@ -433,9 +433,11 @@ func (m *Manager) AllocateForest(forestName string, consumerID string) (response if consumerInfo == nil { return nil, fmt.Errorf("consumer %s does not exist, create and add first", consumerID) } + if forestController.IsConsumerAllocated(consumerID) { return nil, fmt.Errorf("consumer %s already allocated on forest %s", consumerID, forestName) } + resourceNames := forestController.GetResourceNames() forestConsumer, err := consumerInfo.CreateForestConsumer(forestName, resourceNames) if err != nil { diff --git a/test/e2e-kuttl/install-quota-subtree.yaml b/test/e2e-kuttl/install-quota-subtree.yaml index 8580ab2ca..1299cf4ba 100644 --- a/test/e2e-kuttl/install-quota-subtree.yaml +++ b/test/e2e-kuttl/install-quota-subtree.yaml @@ -40,6 +40,7 @@ spec: children: - name: gold quotas: + hardLimit: false requests: cpu: 1075m memory: 450Mi diff --git a/test/e2e-kuttl/quota-forest/06-install.yaml b/test/e2e-kuttl/quota-forest/06-install.yaml index 985cc197b..fb7ba84ac 100644 --- a/test/e2e-kuttl/quota-forest/06-install.yaml +++ b/test/e2e-kuttl/quota-forest/06-install.yaml @@ -9,7 +9,7 @@ metadata: spec: service: spec: {} - priority: 1000 + priority: 10000 resources: metadata: {} GenericItems: