Skip to content

Commit

Permalink
To avoid flooding Operator log
Browse files Browse the repository at this point in the history
  • Loading branch information
cniackz committed Sep 15, 2023
1 parent 392b3f3 commit 01f6811
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/runtime/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ func (s *ObjectSyncer) Sync(ctx context.Context) (SyncResult, error) {
default:
result.SetEventData(eventNormal, EventReason(s.Obj, err),
fmt.Sprintf("%s %s %s successfully", s.objectTypeName(s.Obj), key, result.Operation))
klog.Infof("%s key %s kind %s diff %s", string(result.Operation), key, s.objectTypeName(s.Obj), diff)
// Only print this log if there is a difference to show for the sync
// otherwise keep it like this to avoid flooding the Operator log with unchanged difference.
if diff != nil {
klog.Infof("%s key %s kind %s diff %s", string(result.Operation), key, s.objectTypeName(s.Obj), diff)
}
}

return result, err
Expand Down

0 comments on commit 01f6811

Please sign in to comment.