Skip to content

Commit

Permalink
grpcutil: Remove load balancer references
Browse files Browse the repository at this point in the history
Signed-off-by: Arve Knudsen <[email protected]>
  • Loading branch information
aknuds1 committed Jan 4, 2022
1 parent 5f5929b commit e717f2a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions grpcutil/dns_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ func (w *dnsWatcher) lookupSRV() map[string]*Update {
return nil
}
for _, s := range srvs {
lbAddrs, err := lookupHost(w.ctx, s.Target)
addrs, err := lookupHost(w.ctx, s.Target)
if err != nil {
level.Warn(w.logger).Log("msg", "failed load balancer address DNS lookup", "err", err)
level.Warn(w.logger).Log("msg", "failed SRV target DNS lookup", "target", s.Target, "err", err)
continue
}
for _, a := range lbAddrs {
for _, a := range addrs {
a, ok := formatIP(a)
if !ok {
level.Error(w.logger).Log("failed IP parsing", "err", err)
Expand Down Expand Up @@ -241,8 +241,7 @@ func (w *dnsWatcher) lookupHost() map[string]*Update {
func (w *dnsWatcher) lookup() []*Update {
newAddrs := w.lookupSRV()
if newAddrs == nil {
// If we failed to get any balancer address (either no corresponding SRV for the
// target, or caused by failure during resolution/parsing of the balancer target),
// If we failed to get any valid addresses from SRV record lookup,
// return any A record info available.
newAddrs = w.lookupHost()
}
Expand Down

0 comments on commit e717f2a

Please sign in to comment.