Merge pull request #6843 from simonpasquier/simplify-send-func

discovery/kubernetes: remove extraneous parameters from send()
This commit is contained in:
Frederic Branczyk 2020-02-21 11:23:29 +01:00 committed by GitHub
commit 20a94e62ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 11 deletions

View file

@ -169,7 +169,7 @@ func (e *Endpoints) process(ctx context.Context, ch chan<- []*targetgroup.Group)
return true return true
} }
if !exists { if !exists {
send(ctx, e.logger, RoleEndpoint, ch, &targetgroup.Group{Source: endpointsSourceFromNamespaceAndName(namespace, name)}) send(ctx, ch, &targetgroup.Group{Source: endpointsSourceFromNamespaceAndName(namespace, name)})
return true return true
} }
eps, err := convertToEndpoints(o) eps, err := convertToEndpoints(o)
@ -177,7 +177,7 @@ func (e *Endpoints) process(ctx context.Context, ch chan<- []*targetgroup.Group)
level.Error(e.logger).Log("msg", "converting to Endpoints object failed", "err", err) level.Error(e.logger).Log("msg", "converting to Endpoints object failed", "err", err)
return true return true
} }
send(ctx, e.logger, RoleEndpoint, ch, e.buildEndpoints(eps)) send(ctx, ch, e.buildEndpoints(eps))
return true return true
} }

View file

@ -109,7 +109,7 @@ func (i *Ingress) process(ctx context.Context, ch chan<- []*targetgroup.Group) b
return true return true
} }
if !exists { if !exists {
send(ctx, i.logger, RoleIngress, ch, &targetgroup.Group{Source: ingressSourceFromNamespaceAndName(namespace, name)}) send(ctx, ch, &targetgroup.Group{Source: ingressSourceFromNamespaceAndName(namespace, name)})
return true return true
} }
eps, err := convertToIngress(o) eps, err := convertToIngress(o)
@ -117,7 +117,7 @@ func (i *Ingress) process(ctx context.Context, ch chan<- []*targetgroup.Group) b
level.Error(i.logger).Log("msg", "converting to Ingress object failed", "err", err) level.Error(i.logger).Log("msg", "converting to Ingress object failed", "err", err)
return true return true
} }
send(ctx, i.logger, RoleIngress, ch, i.buildIngress(eps)) send(ctx, ch, i.buildIngress(eps))
return true return true
} }

View file

@ -470,7 +470,7 @@ func lv(s string) model.LabelValue {
return model.LabelValue(s) return model.LabelValue(s)
} }
func send(ctx context.Context, l log.Logger, role Role, ch chan<- []*targetgroup.Group, tg *targetgroup.Group) { func send(ctx context.Context, ch chan<- []*targetgroup.Group, tg *targetgroup.Group) {
if tg == nil { if tg == nil {
return return
} }

View file

@ -118,7 +118,7 @@ func (n *Node) process(ctx context.Context, ch chan<- []*targetgroup.Group) bool
return true return true
} }
if !exists { if !exists {
send(ctx, n.logger, RoleNode, ch, &targetgroup.Group{Source: nodeSourceFromName(name)}) send(ctx, ch, &targetgroup.Group{Source: nodeSourceFromName(name)})
return true return true
} }
node, err := convertToNode(o) node, err := convertToNode(o)
@ -126,7 +126,7 @@ func (n *Node) process(ctx context.Context, ch chan<- []*targetgroup.Group) bool
level.Error(n.logger).Log("msg", "converting to Node object failed", "err", err) level.Error(n.logger).Log("msg", "converting to Node object failed", "err", err)
return true return true
} }
send(ctx, n.logger, RoleNode, ch, n.buildNode(node)) send(ctx, ch, n.buildNode(node))
return true return true
} }

View file

@ -121,7 +121,7 @@ func (p *Pod) process(ctx context.Context, ch chan<- []*targetgroup.Group) bool
return true return true
} }
if !exists { if !exists {
send(ctx, p.logger, RolePod, ch, &targetgroup.Group{Source: podSourceFromNamespaceAndName(namespace, name)}) send(ctx, ch, &targetgroup.Group{Source: podSourceFromNamespaceAndName(namespace, name)})
return true return true
} }
eps, err := convertToPod(o) eps, err := convertToPod(o)
@ -129,7 +129,7 @@ func (p *Pod) process(ctx context.Context, ch chan<- []*targetgroup.Group) bool
level.Error(p.logger).Log("msg", "converting to Pod object failed", "err", err) level.Error(p.logger).Log("msg", "converting to Pod object failed", "err", err)
return true return true
} }
send(ctx, p.logger, RolePod, ch, p.buildPod(eps)) send(ctx, ch, p.buildPod(eps))
return true return true
} }

View file

@ -114,7 +114,7 @@ func (s *Service) process(ctx context.Context, ch chan<- []*targetgroup.Group) b
return true return true
} }
if !exists { if !exists {
send(ctx, s.logger, RoleService, ch, &targetgroup.Group{Source: serviceSourceFromNamespaceAndName(namespace, name)}) send(ctx, ch, &targetgroup.Group{Source: serviceSourceFromNamespaceAndName(namespace, name)})
return true return true
} }
eps, err := convertToService(o) eps, err := convertToService(o)
@ -122,7 +122,7 @@ func (s *Service) process(ctx context.Context, ch chan<- []*targetgroup.Group) b
level.Error(s.logger).Log("msg", "converting to Service object failed", "err", err) level.Error(s.logger).Log("msg", "converting to Service object failed", "err", err)
return true return true
} }
send(ctx, s.logger, RoleService, ch, s.buildService(eps)) send(ctx, ch, s.buildService(eps))
return true return true
} }