Files
client-go/tools
Patrick Ohly b37e79caad client-go cache: allow passing name+logger to DeltaFIFO, RealFIFO and Reflector
This improves logging and enables more informative waiting for cache sync in a
following commit. It addresses one klog.TODO in the Reflector.

The RealFIFOOptions and InformerOptions structs get extended the same way as
DeltaFIFOOptions before: a logger may be set, but it's not required. This is
not an API break.

That the name has to be passed separately is a bit annoying at first glance
because it could also be set directly on the logger through WithName, but
keeping it separate is better:
- name can be set without providing a logger
- name can be defaulted
- less code in the caller when passing through a logger and adding
  the name only in the field
- last but not least, extracting the name is not supported in a portable
  manner by logr

All in-tree references in production code get updated.

While at it, logging in the fifos gets updated to follow best practices: if
some code encounters an abnormal situation and then continues, it should use
utilruntime.HandleErrorWithLogger instead of normal error logging.

Existing "logger" fields get moved to the top because that is a more common
place for such a read-only field.

Kubernetes-commit: 45251e5f654e6c052659d110cd721f9fbe185191
2025-11-18 18:09:46 +01:00
..
2023-02-28 21:22:40 +01:00
2026-01-07 13:16:25 +00:00