Watching for Istio ServiceEntry resources via K8s API

Hi all,

I would like to make use of K8s Informer API functionality to watch for Istio ServiceEntries objects and to patch the resource manifest via some custom logic. Are there any examples on how to get this done for Istio CRDs? I’ve tried the below code but unfortunately it’s not working as expected.

    watchlist := cache.NewListWatchFromClient(

    _, controller := cache.NewInformer(
        0, //Duration is int64
            AddFunc: func(obj interface{}) {
                fmt.Printf("service entry added: %s \n", obj)
            DeleteFunc: func(obj interface{}) {
                fmt.Printf("service entry deleted: %s \n", obj)
            UpdateFunc: func(oldObj, newObj interface{}) {
                fmt.Printf("service entry changed \n")

I get the following response:

E0824 12:50:56.625283   81045 reflector.go:178] pkg/mod/ Failed to list *v1alpha3.ServiceEntry: the server could not find the requested resource