Skip to content

Expose an EventRecorder to the handler to allow recording custom events #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andersjanmyr opened this issue May 10, 2018 · 4 comments
Closed
Labels
blocked kind/feature Categorizes issue or PR as related to a new feature.

Comments

@andersjanmyr
Copy link
Contributor

In order to record events for the operator it would be beneficial if the SDK would expose the EventRecorder interface.

Example (from https://github.com/kubernetes/sample-controller/blob/master/controller.go#L103-L107)

eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(glog.Infof)
eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeclientset.CoreV1().Events("")})
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName})

I'd be happy to work on this, but I would like your feedback as to how you would like to expose the recorder to the handler.

This may be related to #146 .

@xiang90
Copy link

xiang90 commented May 11, 2018

@andersjanmyr

What do you want to record? The incoming events and the actions to take or some customized stuff? If it is the former, we can have a default implementation that does it for the users. The user only need to enable it like sdk.EnableAutoRecording(). If it is the latter, we do need to have a wrapper around the native kube api.

@andersjanmyr
Copy link
Contributor Author

@xiang90 I was thinking of the latter, custom events. I'm not sure that all the events that all incoming events will be interesting and I will definitely need to modify the events as they come in.

@hasbro17
Copy link
Contributor

@andersjanmyr This issue depends on #169
The current APIs exposed to the handler are all package level and depend on global states(scheme, config, clientsets). Any new API or client that's exposed to the handler would be adding to that state.

We're currently working on removing all global state by defining the necessary objects and interfaces. Once that's done we can expose the correct API to the Handler to record its custom events.

@spahl spahl added blocked kind/feature Categorizes issue or PR as related to a new feature. labels Jun 5, 2018
@shawn-hurley
Copy link
Member

You can now access the event recorder from the manager GetRecorder(name string) record.EventRecorder

If you feel this should not be closed please re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

5 participants