func RecordEventf(eventRecorder record.EventRecorder, object metav1.Object, scheme *runtime.Scheme, eventtype, reason, messageFmt string, args ...interface{}) error {
	runtimeObject, ok := object.(runtime.Object)
	if !ok {
		return fmt.Errorf("object (%T) is not a runtime.Object", object)
	}
	objectRef, err := reference.GetReference(scheme, runtimeObject)
	if err != nil {
		return fmt.Errorf("Unable to get reference to owner")
	}
	eventRecorder.Eventf(objectRef, eventtype, reason, messageFmt, args...)
	return nil
}
RecordEventf is a helper function to create an event for the given object.
package k8s
import (
	"fmt"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/client-go/tools/record"
	"k8s.io/client-go/tools/reference"
)