Skip to content

Commit

Permalink
fix: just reconcile active AccessRequests on AppProject or RoleTempla…
Browse files Browse the repository at this point in the history
…te change (#52)

Signed-off-by: Leonardo Luz Almeida <[email protected]>
  • Loading branch information
leoluz authored Oct 31, 2024
1 parent 00e02a8 commit faf67d1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/controller/accessrequest_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit faf67d1

Please sign in to comment.