From faf67d1a05442540baaddbf2b5a2ee5fe77b09ed Mon Sep 17 00:00:00 2001 From: Leonardo Luz Almeida Date: Thu, 31 Oct 2024 16:03:44 -0400 Subject: [PATCH] fix: just reconcile active AccessRequests on AppProject or RoleTemplate change (#52) Signed-off-by: Leonardo Luz Almeida --- internal/controller/accessrequest_controller.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/controller/accessrequest_controller.go b/internal/controller/accessrequest_controller.go index 1cc7c6d..e7bba4d 100644 --- a/internal/controller/accessrequest_controller.go +++ b/internal/controller/accessrequest_controller.go @@ -365,15 +365,15 @@ func (r *AccessRequestReconciler) callReconcileForRoleTemplate(ctx context.Conte return []reconcile.Request{} } - requests := make([]reconcile.Request, len(attachedAccessRequests.Items)) - for i, item := range attachedAccessRequests.Items { + requests := []reconcile.Request{} + for _, item := range attachedAccessRequests.Items { if !isConcluded(&item) { - requests[i] = reconcile.Request{ + requests = append(requests, reconcile.Request{ NamespacedName: types.NamespacedName{ Name: item.GetName(), Namespace: item.GetNamespace(), }, - } + }) } } totalRequests := len(requests) @@ -427,15 +427,15 @@ func (r *AccessRequestReconciler) callReconcileForProject(ctx context.Context, p return []reconcile.Request{} } - requests := make([]reconcile.Request, len(associatedAccessRequests.Items)) - for i, item := range associatedAccessRequests.Items { + requests := []reconcile.Request{} + for _, item := range associatedAccessRequests.Items { if !isConcluded(&item) { - requests[i] = reconcile.Request{ + requests = append(requests, reconcile.Request{ NamespacedName: types.NamespacedName{ Name: item.GetName(), Namespace: item.GetNamespace(), }, - } + }) } } totalRequests := len(requests)