chore: add error handling on registering event handlers to k8s (#3663)

master
Kevin Wan 1 year ago committed by GitHub
parent e20ccdd011
commit 36bbc6a2e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,7 +68,11 @@ func (b *kubeBuilder) Build(target resolver.Target, cc resolver.ClientConn,
options.FieldSelector = nameSelector + svc.Name options.FieldSelector = nameSelector + svc.Name
})) }))
in := inf.Core().V1().Endpoints() in := inf.Core().V1().Endpoints()
in.Informer().AddEventHandler(handler) _, err = in.Informer().AddEventHandler(handler)
if err != nil {
return nil, err
}
threading.GoSafe(func() { threading.GoSafe(func() {
inf.Start(proc.Done()) inf.Start(proc.Done())
}) })
@ -76,6 +80,7 @@ func (b *kubeBuilder) Build(target resolver.Target, cc resolver.ClientConn,
if err != nil { if err != nil {
return nil, err return nil, err
} }
handler.Update(endpoints) handler.Update(endpoints)
return &nopResolver{cc: cc}, nil return &nopResolver{cc: cc}, nil

Loading…
Cancel
Save