system scheduler: account for alloc resources when checking node feasibility #27055
+71
−55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CE part of nomad-enterprise PR
https://github.com/hashicorp/nomad-enterprise/pull/3372
In the past, when doing feasibility checks, we'd perform them in one big loop
in the computePlacements method. At the very end of each node check, should
we get a feasible option from the stack, we'd construct an allocation and
append it to plan. On every subsequent iteration of the loop, stack iterators
that needed to take into account accumulative resource usage (at the moment
it's just the QuotaIterator) would look at the plan and judge feasibility
based on it. Although not a perfect solution (the first placement would
always go through even if it violated the quota!), merging
#26953 broke this behavior, because now
feasible nodes are being found before any placements or plan appends happen.
Thus, QuotaIterator would always get a clean slate of resources used and we
would end up with placements that violate limits.
This changeset modifies the behavior of findNodesForTG method in the
scheduler. If there are quotas enabled for the namespace, it creates a dummy
allocation and temporarily appends it to the plan, in order to get accurate
quota checks.