-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop ObjectReference parameters and improve logger
This commit addresses the two rough edges mentioned by Michael. > You have to supply an ObjectReference to both the metrics and the > events methods. As the helper methods are always called from within a reconciler, and both events and metrics must only be recorderd for well known resources, the methods of the helpers should only be called for objects that do contain data about the kind and/or version. This means that calling `reference.GetReference` within the helper methods will generally not result in any errors, nor be a really expensive calculation. In cases where the GVK information for some reason is not available on the object, `GetReference` will still be capable of falling back to the manager's `runtime.Scheme` that is now injected to the helper. Resulting in a - in my personal opinion - fair trade-off, and a much more friendly API from the consumer's perspective. > You have to pass logs in to the Events helper. By relying on the context of the reconcile operation we get a logger (with object metadata preconfigured) for free. Signed-off-by: Hidde Beydals <hello@hidde.co>
- Loading branch information
Showing
2 changed files
with
54 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters