Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Fix event recorder scheme #1981

Merged

Conversation

ash2k
Copy link
Contributor

@ash2k ash2k commented Apr 24, 2018

Fixes #1628.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 24, 2018
Copy link
Contributor

@MHBauer MHBauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a test?

defer loggingWatch.Stop()
recordingWatch := eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: k8sKubeClient.CoreV1().Events("")})
defer recordingWatch.Stop()
recorder := eventBroadcaster.NewRecorder(eventsScheme, v1.EventSource{Component: controllerManagerAgentName})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any "wait to be ready" type function that needs to be called? I'm thinking of how informers work. I think because this is a push, where that is a watch, we're fine without any such call being necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, afaik. Events work for instances and bindings, for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my understanding, yes.

@@ -187,10 +190,25 @@ func Run(controllerManagerOptions *options.ControllerManagerServer) error {

// Create event broadcaster
glog.V(4).Info("Creating event broadcaster")
eventsScheme := runtime.NewScheme()
// We use ConfigMapLock/EndpointsLock which emit events for ConfigMap/Endpoints and hence we need core/v1 types for it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good comments.

@jboyd01
Copy link
Contributor

jboyd01 commented Apr 25, 2018

I had spent some time investigating this issue yesterday and found the Scheme we were using was "bad" - I found that using Scheme from k8s.io/client-go/kubernetes/scheme also addressed the eventing issue, though I'm not certain it had Catalog's types registered. Your fix LGTM.

@jboyd01 jboyd01 added the LGTM1 label Apr 25, 2018
Copy link
Contributor

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@carolynvs
Copy link
Contributor

I was wondering about a test myself but wasn't sure how to even go about testing it? I'll hold off on merging for a sec just in case.

@MHBauer MHBauer added the LGTM3 label Apr 25, 2018
@jboyd01
Copy link
Contributor

jboyd01 commented Apr 25, 2018

When I was working on a fix separately yesterday, I changed https://github.com/kubernetes-incubator/service-catalog/blob/master/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go#L199 to add le.config.Lock.RecordEvent("testing event recording, still leading") and verified this shows up when you do a kubectl describe configmap service-catalog-controller-manager -n catalog

Probably achievable with an integration test, but I'm not certain its worth the effort.

@carolynvs
Copy link
Contributor

Executive Decision: :shipit:

@carolynvs carolynvs merged commit 5a51a20 into kubernetes-retired:master Apr 25, 2018
@ash2k ash2k deleted the fix-event-recorder-scheme branch January 20, 2019 03:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. LGTM1 LGTM2 LGTM3 size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants