Skip to content

Commit

Permalink
grpcutil: Remove gRPC load balancer metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
  • Loading branch information
aknuds1 committed Dec 23, 2021
1 parent d3fb543 commit dd6b6e4
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions grpcutil/dns_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,26 +169,6 @@ func (i *ipWatcher) Close() {
close(i.updateChan)
}

// AddressType indicates the address type returned by name resolution.
type AddressType uint8

const (
// Backend indicates the server is a backend server.
Backend AddressType = iota
// GRPCLB indicates the server is a grpclb load balancer.
GRPCLB
)

// AddrMetadataGRPCLB contains the information the name resolver for grpclb should provide. The
// name resolver used by the grpclb balancer is required to provide this type of metadata in
// its address updates.
type AddrMetadataGRPCLB struct {
// AddrType is the type of server (grpc load balancer or backend).
AddrType AddressType
// ServerName is the name of the grpc load balancer. Used for authentication.
ServerName string
}

// compileUpdate compares the old resolved addresses and newly resolved addresses,
// and generates an update list
func (w *dnsWatcher) compileUpdate(newAddrs map[string]*Update) []*Update {
Expand Down Expand Up @@ -232,8 +212,7 @@ func (w *dnsWatcher) lookupSRV() map[string]*Update {
continue
}
addr := a + ":" + strconv.Itoa(int(s.Port))
newAddrs[addr] = &Update{Addr: addr,
Metadata: AddrMetadataGRPCLB{AddrType: GRPCLB, ServerName: s.Target}}
newAddrs[addr] = &Update{Addr: addr}
}
}
return newAddrs
Expand Down

0 comments on commit dd6b6e4

Please sign in to comment.