File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
pkg/scheduler/plugins/capacity Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -120,11 +120,16 @@ func (cp *capacityPlugin) OnSessionOpen(ssn *framework.Session) {
120120 allocated := allocations [job .Queue ]
121121
122122 exceptReclaimee := allocated .Clone ().Sub (reclaimee .Resreq )
123- // When scalar resource not specified in deserved such as "pods", we should skip it and consider it as infinity,
124- // so the following first condition will be true and the current queue will not be reclaimed.
125- if allocated .LessEqual (attr .deserved , api .Infinity ) || ! attr .guarantee .LessEqual (exceptReclaimee , api .Zero ) {
123+ // The `api.Infinity` parameter ensures that for any scalar resource present in `allocated` but not defined in `deserved` (e.g., "pods"),
124+ // the check is skipped, effectively treating `deserved` as infinite for that resource. This prevents such resources from causing a reclaim.
125+ // Skip reclaim in two cases:
126+ // 1. Current allocated <= deserved (queue not over-quota yet)
127+ // 2. Evicting would cause allocated < deserved in any reclaimer's requested dimension
128+ reclaimable , _ := attr .deserved .LessEqualWithDimensionAndResourcesName (exceptReclaimee , reclaimer .Resreq )
129+ if allocated .LessEqual (attr .deserved , api .Infinity ) || ! reclaimable {
126130 continue
127131 }
132+
128133 allocated .Sub (reclaimee .Resreq )
129134 victims = append (victims , reclaimee )
130135 }
You can’t perform that action at this time.
0 commit comments