Skip to content
Merged
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions pkg/audit/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ func (am *Manager) auditResources(
for gv, gvKinds := range clusterAPIResources {
kindsLoop:
for kind := range gvKinds {
log.Info("Listing objects for GVK", "group", gv.Group, "version", gv.Version, "kind", kind)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we want this line and the following to actual use the manager log? am.log. Before we call auditResources we actually tag the audit manager log w the auditID which could be used to aggregate audit runs.

https://github.com/open-policy-agent/gatekeeper/blob/master/pkg/audit/manager.go#L165

@ritazh ritazh Jan 11, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but that one defaults to always log. +1 on exposing verbosity to the operator so it doesn't flood the logs unless you need it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, yes, am.log() is a better call.

@ritazh I think logging/not logging is governed by the log level flag?

// delete all existing folders from cache dir before starting next kind
err := am.removeAllFromDir(*apiCacheDir, int(*auditChunkSize))
if err != nil {
Expand Down Expand Up @@ -436,15 +437,19 @@ func (am *Manager) auditResources(
resourceVersion = objList.GetResourceVersion()
opts.Continue = objList.GetContinue()
if opts.Continue == "" {
log.Info("Finished listing objects for GVK", "group", gv.Group, "version", gv.Version, "kind", kind)
break
}
log.Info("Requesting next chunk of objects for GVK", "group", gv.Group, "version", gv.Version, "kind", kind)
}
// Loop through all subDirs to review all files for this kind.
log.Info("Reviewing objects for GVK", gv.Group, "version", gv.Version, "kind", kind)
err = am.reviewObjects(ctx, kind, folderCount, namespaceCache, updateLists, totalViolationsPerConstraint, totalViolationsPerEnforcementAction, timestamp)
if err != nil {
errs = append(errs, err)
continue
}
log.Info("Review complete for GVK", gv.Group, "version", gv.Version, "kind", kind)
}
}

Expand Down