Skip to content

Commit

Permalink
feat: More verbose logging for audit (#2503)
Browse files Browse the repository at this point in the history
* feat: More verbose logging for audit

Signed-off-by: Max Smythe <smythe@google.com>

* Reduce log priority

Signed-off-by: Max Smythe <smythe@google.com>

Signed-off-by: Max Smythe <smythe@google.com>
  • Loading branch information
maxsmythe authored Jan 12, 2023
1 parent bb11f3e commit beb2432
Showing 1 changed file with 5 additions and 0 deletions.
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 {
am.log.V(logging.DebugLevel).Info("Listing objects for GVK", "group", gv.Group, "version", gv.Version, "kind", kind)
// 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 == "" {
am.log.V(logging.DebugLevel).Info("Finished listing objects for GVK", "group", gv.Group, "version", gv.Version, "kind", kind)
break
}
am.log.V(logging.DebugLevel).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.
am.log.V(logging.DebugLevel).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
}
am.log.V(logging.DebugLevel).Info("Review complete for GVK", gv.Group, "version", gv.Version, "kind", kind)
}
}

Expand Down

0 comments on commit beb2432

Please sign in to comment.