mirror of
https://github.com/kubernetes/client-go.git
synced 2026-02-22 08:03:18 +00:00
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