You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently KymaReconciler uses the dependency of EventRecorder directly, which exposes all possibilities of sending events.
To limit the chance of introducing more calls to r.Event() and to introduce error truncation into the warning event payload generation, we want to wrap the consumption of the EventRecorder.
Reasons
Testability, Reduce Error message size for smaller events in etcd
Acceptance Criteria
Introduce new interface dependency to KymaReconciler called Event as embedded struct
Provide two methods Normal() and Warning() and replace existing occurrences of r.Event(*) (see below) by calling these two methods instead, e.g. r.Event.Warning(kyma, reason, err)
The Warning() event function will again accept an error parameter in its signature, but it truncates the length of err.Error() (refine!)
Think about separate implementations of KymaEvent, WatcherEvent, etc. if they make sense
Since Event implementation will be initialized with mgr.GetEventRecorderFor(shared.OperatorName) the pointer to the dependency can be shared on setup between all consumers, which makes the sharing the event recorder via context obsolete, so the adapter pkg can be deleted as well
For integration test there will be an implementation of the Events interface that provides initialization with k8sManager.GetEventRecorderFor(shared.OperatorName) as seen here
Description
Currently KymaReconciler uses the dependency of EventRecorder directly, which exposes all possibilities of sending events.
To limit the chance of introducing more calls to r.Event() and to introduce error truncation into the warning event payload generation, we want to wrap the consumption of the EventRecorder.
Reasons
Testability, Reduce Error message size for smaller events in etcd
Acceptance Criteria
KymaReconciler
calledEvent
as embedded structNormal()
andWarning()
and replace existing occurrences ofr.Event(*)
(see below) by calling these two methods instead, e.g.r.Event.Warning(kyma, reason, err)
Warning()
event function will again accept an error parameter in its signature, but it truncates the length oferr.Error()
(refine!)KymaEvent
,WatcherEvent
, etc. if they make senseEvent
implementation will be initialized withmgr.GetEventRecorderFor(shared.OperatorName)
the pointer to the dependency can be shared on setup between all consumers, which makes the sharing the event recorder via context obsolete, so the adapter pkg can be deleted as wellk8sManager.GetEventRecorderFor(shared.OperatorName)
as seen hereFeature Testing
Unit tests
Testing approach
The
Events
interface implementation can be fully unit tested.Attachments
No response
The text was updated successfully, but these errors were encountered: