|
|
@ -83,6 +83,8 @@ func (e *Endpoints) Run(ctx context.Context, ch chan<- []*config.TargetGroup) {
|
|
|
|
|
|
|
|
|
|
|
|
e.endpointsInf.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
|
|
|
e.endpointsInf.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
|
|
|
AddFunc: func(o interface{}) {
|
|
|
|
AddFunc: func(o interface{}) {
|
|
|
|
|
|
|
|
eventCount.WithLabelValues("endpoints", "add").Inc()
|
|
|
|
|
|
|
|
|
|
|
|
eps, err := convertToEndpoints(o)
|
|
|
|
eps, err := convertToEndpoints(o)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
e.logger.With("err", err).Errorln("converting to Endpoints object failed")
|
|
|
|
e.logger.With("err", err).Errorln("converting to Endpoints object failed")
|
|
|
@ -91,6 +93,8 @@ func (e *Endpoints) Run(ctx context.Context, ch chan<- []*config.TargetGroup) {
|
|
|
|
send(e.buildEndpoints(eps))
|
|
|
|
send(e.buildEndpoints(eps))
|
|
|
|
},
|
|
|
|
},
|
|
|
|
UpdateFunc: func(_, o interface{}) {
|
|
|
|
UpdateFunc: func(_, o interface{}) {
|
|
|
|
|
|
|
|
eventCount.WithLabelValues("endpoints", "update").Inc()
|
|
|
|
|
|
|
|
|
|
|
|
eps, err := convertToEndpoints(o)
|
|
|
|
eps, err := convertToEndpoints(o)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
e.logger.With("err", err).Errorln("converting to Endpoints object failed")
|
|
|
|
e.logger.With("err", err).Errorln("converting to Endpoints object failed")
|
|
|
@ -99,6 +103,8 @@ func (e *Endpoints) Run(ctx context.Context, ch chan<- []*config.TargetGroup) {
|
|
|
|
send(e.buildEndpoints(eps))
|
|
|
|
send(e.buildEndpoints(eps))
|
|
|
|
},
|
|
|
|
},
|
|
|
|
DeleteFunc: func(o interface{}) {
|
|
|
|
DeleteFunc: func(o interface{}) {
|
|
|
|
|
|
|
|
eventCount.WithLabelValues("endpoints", "delete").Inc()
|
|
|
|
|
|
|
|
|
|
|
|
eps, err := convertToEndpoints(o)
|
|
|
|
eps, err := convertToEndpoints(o)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
e.logger.With("err", err).Errorln("converting to Endpoints object failed")
|
|
|
|
e.logger.With("err", err).Errorln("converting to Endpoints object failed")
|
|
|
@ -129,9 +135,18 @@ func (e *Endpoints) Run(ctx context.Context, ch chan<- []*config.TargetGroup) {
|
|
|
|
e.serviceInf.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
|
|
|
e.serviceInf.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
|
|
|
// TODO(fabxc): potentially remove add and delete event handlers. Those should
|
|
|
|
// TODO(fabxc): potentially remove add and delete event handlers. Those should
|
|
|
|
// be triggered via the endpoint handlers already.
|
|
|
|
// be triggered via the endpoint handlers already.
|
|
|
|
AddFunc: func(o interface{}) { serviceUpdate(o) },
|
|
|
|
AddFunc: func(o interface{}) {
|
|
|
|
UpdateFunc: func(_, o interface{}) { serviceUpdate(o) },
|
|
|
|
eventCount.WithLabelValues("service", "add").Inc()
|
|
|
|
DeleteFunc: func(o interface{}) { serviceUpdate(o) },
|
|
|
|
serviceUpdate(o)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
UpdateFunc: func(_, o interface{}) {
|
|
|
|
|
|
|
|
eventCount.WithLabelValues("service", "update").Inc()
|
|
|
|
|
|
|
|
serviceUpdate(o)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
DeleteFunc: func(o interface{}) {
|
|
|
|
|
|
|
|
eventCount.WithLabelValues("service", "delete").Inc()
|
|
|
|
|
|
|
|
serviceUpdate(o)
|
|
|
|
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// Block until the target provider is explicitly canceled.
|
|
|
|
// Block until the target provider is explicitly canceled.
|
|
|
|