diff --git a/cmd/init-container/main.go b/cmd/init-container/main.go index e087e49c..19570c69 100644 --- a/cmd/init-container/main.go +++ b/cmd/init-container/main.go @@ -51,7 +51,7 @@ func main() { eventBroadcast := util.NewRecorder(ctx, kubeClient) defer eventBroadcast.Shutdown() - recorder := eventBroadcast.NewRecorder(scheme.Scheme, v1.EventSource{Component: "k8s.io.api.core.v1.Pod"}) + recorder := eventBroadcast.NewRecorder(scheme.Scheme, v1.EventSource{Component: "virtual kubelet"}) vkVersion, err := strconv.ParseBool(os.Getenv("USE_VK_VERSION_2")) if err != nil { log.G(ctx).Warn("cannot get USE_VK_VERSION_2 environment variable, the provider will use VK version 1. Skipping init container checks") diff --git a/pkg/util/events.go b/pkg/util/events.go index a594523b..5306222b 100644 --- a/pkg/util/events.go +++ b/pkg/util/events.go @@ -15,8 +15,7 @@ import ( func NewRecorder(ctx context.Context, kubeClient *kubernetes.Clientset) record.EventBroadcaster { eventBroadcaster := record.NewBroadcaster() eventBroadcaster.StartStructuredLogging(3) - if eventBroadcaster != nil && kubeClient != nil { - eventBroadcaster.StartRecordingToSink(&corev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) - } + eventBroadcaster.StartRecordingToSink(&corev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) + return eventBroadcaster }