discovery: kubernetes: Avoid creating unnecessary Kubernetes indexers in RoleEndpointSlice

This was due to a missing "return", see https://github.com/prometheus/prometheus/pull/13554#discussion_r1490965817

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
This commit is contained in:
machine424 2024-02-16 14:21:10 +01:00
parent d595f5a9b1
commit 92544c00bf
No known key found for this signature in database
GPG key ID: A4B001A4FDEE017D
3 changed files with 51 additions and 4 deletions

View file

@ -815,7 +815,7 @@ func (d *Discovery) newEndpointsByNodeInformer(plw *cache.ListWatch) cache.Share
func (d *Discovery) newEndpointSlicesByNodeInformer(plw *cache.ListWatch, object runtime.Object) cache.SharedIndexInformer {
indexers := make(map[string]cache.IndexFunc)
if !d.attachMetadata.Node {
cache.NewSharedIndexInformer(plw, &disv1.EndpointSlice{}, resyncDisabled, indexers)
return cache.NewSharedIndexInformer(plw, object, resyncDisabled, indexers)
}
indexers[nodeIndex] = func(obj interface{}) ([]string, error) {