@@ -170,7 +170,7 @@ func (r *AccessControlListReconciler) Reconcile(ctx context.Context, req ctrl.Re
170170 return ctrl.Result {}, nil
171171 }
172172
173- if conditions .InitializeConditions (obj , v1alpha1 .ReadyCondition ) {
173+ if conditions .InitializeConditions (obj , v1alpha1 .ReadyCondition , v1alpha1 . ConfiguredCondition ) {
174174 log .V (1 ).Info ("Initializing status conditions" )
175175 return ctrl.Result {}, r .Status ().Update (ctx , obj )
176176 }
@@ -263,6 +263,7 @@ type aclScope struct {
263263}
264264
265265func (r * AccessControlListReconciler ) reconcile (ctx context.Context , s * aclScope ) (reterr error ) {
266+ defer conditions .RecomputeReady (s .ACL )
266267 if s .ACL .Labels == nil {
267268 s .ACL .Labels = make (map [string ]string )
268269 }
@@ -298,8 +299,6 @@ func (r *AccessControlListReconciler) reconcile(ctx context.Context, s *aclScope
298299 })
299300
300301 cond := conditions .FromError (err )
301- // As this resource is configuration only, we use the Configured condition as top-level Ready condition.
302- cond .Type = v1alpha1 .ReadyCondition
303302 conditions .Set (s .ACL , cond )
304303
305304 return err
@@ -341,11 +340,11 @@ func (r *AccessControlListReconciler) deviceToAccessControlLists(ctx context.Con
341340 }
342341
343342 requests := make ([]ctrl.Request , 0 , len (list .Items ))
344- for _ , i := range list .Items {
345- log .V (2 ).Info ("Enqueuing AccessControlList for reconciliation" , "AccessControlList" , klog .KObj (& i ))
343+ for i := range list .Items {
344+ log .V (2 ).Info ("Enqueuing AccessControlList for reconciliation" , "AccessControlList" , klog .KObj (& list . Items [ i ] ))
346345 requests = append (requests , ctrl.Request {
347- Name : i .Name ,
348- Namespace : i .Namespace ,
346+ Name : list . Items [ i ] .Name ,
347+ Namespace : list . Items [ i ] .Namespace ,
349348 })
350349 }
351350
0 commit comments