Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return early if the AuthPolicy being filtered is marked for deletion #632

Merged
merged 2 commits into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions controllers/authpolicy_authconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,14 @@ func routeGatewayAuthOverrides(t *kuadrantgatewayapi.Topology, ap *api.AuthPolic
// 1. targets a gateway
// 2. is not the current AP that is being assessed
// 3. is an overriding policy
// 4. is not marked for deletion
affectedPolicies = utils.Filter(affectedPolicies, func(policy kuadrantgatewayapi.Policy) bool {
p, ok := policy.(*api.AuthPolicy)
if !ok {
return false
}
return kuadrantgatewayapi.IsTargetRefGateway(policy.GetTargetRef()) &&
ap.GetUID() != policy.GetUID() && p.IsAtomicOverride()
return ok &&
p.DeletionTimestamp == nil &&
kuadrantgatewayapi.IsTargetRefGateway(policy.GetTargetRef()) &&
ap.GetUID() != policy.GetUID() &&
p.IsAtomicOverride()
})

return utils.Map(affectedPolicies, func(policy kuadrantgatewayapi.Policy) client.ObjectKey {
Expand Down
Loading