From ea2192f043609da54b170f1450f635a993a45242 Mon Sep 17 00:00:00 2001 From: vikaschoudhary16 Date: Tue, 5 Jun 2018 04:50:37 -0400 Subject: [PATCH] Fix quota sync --- pkg/controller/resourcequota/resource_quota_controller.go | 2 +- pkg/quota/resources.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/controller/resourcequota/resource_quota_controller.go b/pkg/controller/resourcequota/resource_quota_controller.go index 75878d9d0e4f0..1aacea387865f 100644 --- a/pkg/controller/resourcequota/resource_quota_controller.go +++ b/pkg/controller/resourcequota/resource_quota_controller.go @@ -337,7 +337,7 @@ func (rq *ResourceQuotaController) syncResourceQuota(v1ResourceQuota *v1.Resourc } hardLimits := quota.Add(api.ResourceList{}, resourceQuota.Spec.Hard) - newUsage, err := quota.CalculateUsage(resourceQuota.Namespace, resourceQuota.Spec.Scopes, hardLimits, rq.registry) + newUsage, err := quota.CalculateUsage(resourceQuota.Namespace, resourceQuota.Spec.Scopes, hardLimits, rq.registry, resourceQuota.Spec.ScopeSelector) if err != nil { return err } diff --git a/pkg/quota/resources.go b/pkg/quota/resources.go index a40a81a64c6ef..f77d2d7428eca 100644 --- a/pkg/quota/resources.go +++ b/pkg/quota/resources.go @@ -253,7 +253,7 @@ func ToSet(resourceNames []api.ResourceName) sets.String { } // CalculateUsage calculates and returns the requested ResourceList usage -func CalculateUsage(namespaceName string, scopes []api.ResourceQuotaScope, hardLimits api.ResourceList, registry Registry) (api.ResourceList, error) { +func CalculateUsage(namespaceName string, scopes []api.ResourceQuotaScope, hardLimits api.ResourceList, registry Registry, scopeSelector *api.ScopeSelector) (api.ResourceList, error) { // find the intersection between the hard resources on the quota // and the resources this controller can track to know what we can // look to measure updated usage stats for @@ -275,7 +275,7 @@ func CalculateUsage(namespaceName string, scopes []api.ResourceQuotaScope, hardL continue } - usageStatsOptions := UsageStatsOptions{Namespace: namespaceName, Scopes: scopes, Resources: intersection} + usageStatsOptions := UsageStatsOptions{Namespace: namespaceName, Scopes: scopes, Resources: intersection, ScopeSelector: scopeSelector} stats, err := evaluator.UsageStats(usageStatsOptions) if err != nil { return nil, err