Set proper InvolvedObject when using library-go EventRecorder
Currently we're getting the error:
Error creating event &Event...
Event ".16c2ed25cd8773b4" is invalid: involvedObject.namespace: Invalid value: "": does not match event.namespace
Related to Bug overlooked in
@@ -153,7 +153,12 @@ func New(
apiExtClient: apiExtClient,
configClient: configClient,
eventRecorder: eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "machineconfigoperator"}),
- libgoRecorder: events.NewRecorder(kubeClient.CoreV1().Events("openshift-machine-config-operator"), "machine-config-operator", &corev1.ObjectReference{}),
+ libgoRecorder: events.NewRecorder(kubeClient.CoreV1().Events("openshift-machine-config-operator"), "machine-config-operator", &corev1.ObjectReference{
+ Kind: "Deployment",
+ Name: "machine-config-operator",
+ Namespace: "openshift-machine-config-operator",
+ APIVersion: "apps/v1",
+ }),
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machineconfigoperator"),
}
