From b116585b225a15273afcec95f22902b2644db0f1 Mon Sep 17 00:00:00 2001 From: mengyang02 Date: Wed, 2 Oct 2019 01:01:01 +0800 Subject: [PATCH] remove redundant quota.V1Equals --- .../resource_quota_controller.go | 2 +- pkg/quota/v1/resources.go | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/pkg/controller/resourcequota/resource_quota_controller.go b/pkg/controller/resourcequota/resource_quota_controller.go index 6a1db2a2a2d..363e077850d 100644 --- a/pkg/controller/resourcequota/resource_quota_controller.go +++ b/pkg/controller/resourcequota/resource_quota_controller.go @@ -128,7 +128,7 @@ func NewResourceQuotaController(options *ResourceQuotaControllerOptions) (*Resou // responsible for enqueue of all resource quotas when doing a full resync (enqueueAll) oldResourceQuota := old.(*v1.ResourceQuota) curResourceQuota := cur.(*v1.ResourceQuota) - if quota.V1Equals(oldResourceQuota.Spec.Hard, curResourceQuota.Spec.Hard) { + if quota.Equals(oldResourceQuota.Spec.Hard, curResourceQuota.Spec.Hard) { return } rq.addQuota(curResourceQuota) diff --git a/pkg/quota/v1/resources.go b/pkg/quota/v1/resources.go index cba69f5073a..9b217489db3 100644 --- a/pkg/quota/v1/resources.go +++ b/pkg/quota/v1/resources.go @@ -45,25 +45,6 @@ func Equals(a corev1.ResourceList, b corev1.ResourceList) bool { return true } -// V1Equals returns true if the two lists are equivalent -func V1Equals(a corev1.ResourceList, b corev1.ResourceList) bool { - if len(a) != len(b) { - return false - } - - for key, value1 := range a { - value2, found := b[key] - if !found { - return false - } - if value1.Cmp(value2) != 0 { - return false - } - } - - return true -} - // LessThanOrEqual returns true if a < b for each key in b // If false, it returns the keys in a that exceeded b func LessThanOrEqual(a corev1.ResourceList, b corev1.ResourceList) (bool, []corev1.ResourceName) {