Skip to content

Commit

Permalink
fix: ns exclusion audit from cache (open-policy-agent#3129)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Pana <8968914+acpana@users.noreply.github.com>
Signed-off-by: alex <8968914+acpana@users.noreply.github.com>
Signed-off-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com>
Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com>
Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
  • Loading branch information
2 people authored and openshift-merge-bot[bot] committed Feb 20, 2024
1 parent 9d3cbcd commit 2a591fb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/audit/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,17 @@ func (am *Manager) auditFromCache(ctx context.Context) ([]Result, []error) {
ns = nil
}

excluded, err := am.skipExcludedNamespace(&obj)
if err != nil {
am.log.Error(err, "Unable to exclude object namespace for audit from cache %v %s/%s", obj.GroupVersionKind().String(), obj.GetNamespace(), obj.GetName())
continue
}

if excluded {
am.log.V(logging.DebugLevel).Info("excluding object from audit from cache %v %s/%s", obj.GroupVersionKind().String(), obj.GetNamespace(), obj.GetName())
continue
}

au := &target.AugmentedUnstructured{
Object: obj,
Namespace: ns,
Expand Down

0 comments on commit 2a591fb

Please sign in to comment.