Use structured logging instead of logrus for event recorders

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/6220/head
Brad Davidson 2022-09-30 21:28:32 +00:00 committed by Brad Davidson
parent 027039530d
commit f633732d80
1 changed files with 1 additions and 1 deletions

View File

@ -104,7 +104,7 @@ func WaitForAPIServerReady(ctx context.Context, kubeconfigPath string, timeout t
func BuildControllerEventRecorder(k8s clientset.Interface, controllerName, namespace string) record.EventRecorder {
logrus.Infof("Creating %s event broadcaster", controllerName)
eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(logrus.Infof)
eventBroadcaster.StartStructuredLogging(0)
eventBroadcaster.StartRecordingToSink(&coregetter.EventSinkImpl{Interface: k8s.CoreV1().Events(namespace)})
nodeName := os.Getenv("NODE_NAME")
return eventBroadcaster.NewRecorder(schemes.All, v1.EventSource{Component: controllerName, Host: nodeName})