mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Ability to quota storage by storage class
This commit is contained in:
@@ -182,9 +182,8 @@ func (rq *ResourceQuotaController) addQuota(obj interface{}) {
|
||||
for constraint := range resourceQuota.Status.Hard {
|
||||
if _, usageFound := resourceQuota.Status.Used[constraint]; !usageFound {
|
||||
matchedResources := []api.ResourceName{api.ResourceName(constraint)}
|
||||
|
||||
for _, evaluator := range rq.registry.Evaluators() {
|
||||
if intersection := quota.Intersection(evaluator.MatchesResources(), matchedResources); len(intersection) != 0 {
|
||||
if intersection := evaluator.MatchingResources(matchedResources); len(intersection) > 0 {
|
||||
rq.missingUsageQueue.Add(key)
|
||||
return
|
||||
}
|
||||
@@ -348,7 +347,6 @@ func (rq *ResourceQuotaController) replenishQuota(groupKind schema.GroupKind, na
|
||||
}
|
||||
|
||||
// only queue those quotas that are tracking a resource associated with this kind.
|
||||
matchedResources := evaluator.MatchesResources()
|
||||
for i := range resourceQuotas {
|
||||
resourceQuota := resourceQuotas[i].(*v1.ResourceQuota)
|
||||
internalResourceQuota := &api.ResourceQuota{}
|
||||
@@ -357,7 +355,7 @@ func (rq *ResourceQuotaController) replenishQuota(groupKind schema.GroupKind, na
|
||||
continue
|
||||
}
|
||||
resourceQuotaResources := quota.ResourceNames(internalResourceQuota.Status.Hard)
|
||||
if len(quota.Intersection(matchedResources, resourceQuotaResources)) > 0 {
|
||||
if intersection := evaluator.MatchingResources(resourceQuotaResources); len(intersection) > 0 {
|
||||
// TODO: make this support targeted replenishment to a specific kind, right now it does a full recalc on that quota.
|
||||
rq.enqueueResourceQuota(resourceQuota)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user