@@ -65,6 +65,8 @@ func (r *HierarchicalResourceQuotaReconciler) Reconcile(ctx context.Context, req
6565 return ctrl.Result {}, err
6666 }
6767
68+ log .Info ("Reconciling HRQ" , "name" , req .NamespacedName .Name , "namespace" , req .NamespacedName .Namespace , "Hard" , inst .Spec .Hard , "scopeSelector" , inst .Spec .ScopeSelector )
69+
6870 // If an object is deleted, assign the name and namespace of the request to
6971 // the object so that they can be used to sync with the forest.
7072 if isDeleted (inst ) {
@@ -74,7 +76,7 @@ func (r *HierarchicalResourceQuotaReconciler) Reconcile(ctx context.Context, req
7476 oldUsages := inst .Status .Used
7577
7678 // Sync with forest to update the HRQ or the in-memory forest.
77- updatedInst , updatedForest , err := r .syncWithForest (inst )
79+ updatedInst , updatedForest , err := r .syncWithForest (log , inst )
7880 if err != nil {
7981 return ctrl.Result {}, err
8082 }
@@ -109,7 +111,7 @@ func (r *HierarchicalResourceQuotaReconciler) Reconcile(ctx context.Context, req
109111// syncWithForest syncs resource limits and resource usages with the in-memory
110112// forest. The first return value is true if the HRQ object is updated; the
111113// second return value is true if the forest is updated.
112- func (r * HierarchicalResourceQuotaReconciler ) syncWithForest (inst * api.HierarchicalResourceQuota ) (bool , bool , error ) {
114+ func (r * HierarchicalResourceQuotaReconciler ) syncWithForest (log logr. Logger , inst * api.HierarchicalResourceQuota ) (bool , bool , error ) {
113115 r .Forest .Lock ()
114116 defer r .Forest .Unlock ()
115117
@@ -118,10 +120,14 @@ func (r *HierarchicalResourceQuotaReconciler) syncWithForest(inst *api.Hierarchi
118120 rqName := api .ResourceQuotaSingletonName
119121 nn := types.NamespacedName {Name : inst .GetName (), Namespace : inst .GetNamespace ()}
120122 if isScopedHRQ {
123+ log .Info ("Marking HRQ as scoped" , "name" , inst .GetName (), "namespace" , inst .GetNamespace ())
121124 r .Forest .MarkScopedRQ (nn )
122125 rqName = utils .ScopedRQName (inst .GetName ())
123126 } else if r .Forest .IsMarkedAsScopedHRQ (nn ) {
127+ log .Info ("Detect the Scoped HRQ because of the mark" )
124128 rqName = utils .ScopedRQName (inst .GetName ())
129+ } else {
130+ log .Info ("HRQ is a singleton" )
125131 }
126132
127133 updatedInst := false
@@ -139,7 +145,11 @@ func (r *HierarchicalResourceQuotaReconciler) syncWithForest(inst *api.Hierarchi
139145 }
140146
141147 // Update HRQ usages if they are changed.
142- r .syncUsages (inst , rqName )
148+ err = r .syncUsages (inst , rqName )
149+ if err != nil {
150+ return false , false , err
151+ }
152+
143153 updatedInst = updatedInst || ! utils .Equals (oldUsages , inst .Status .Used )
144154
145155 return updatedInst , updatedForest , nil
0 commit comments