agent: Remove xdsServer field

The field is only referenced from a single method, it can be a local var
This commit is contained in:
Daniel Nephin 2020-03-21 14:59:39 -04:00
parent 0665c56c26
commit 266bdf7465
1 changed files with 4 additions and 7 deletions

View File

@ -291,9 +291,6 @@ type Agent struct {
// the centrally configured proxy/service defaults. // the centrally configured proxy/service defaults.
serviceManager *ServiceManager serviceManager *ServiceManager
// xdsServer is the Server instance that serves xDS gRPC API.
xdsServer *xds.Server
// grpcServer is the server instance used currently to serve xDS API for // grpcServer is the server instance used currently to serve xDS API for
// Envoy. // Envoy.
grpcServer *grpc.Server grpcServer *grpc.Server
@ -736,7 +733,7 @@ func (a *Agent) listenAndServeGRPC() error {
return nil return nil
} }
a.xdsServer = &xds.Server{ xdsServer := &xds.Server{
Logger: a.logger, Logger: a.logger,
CfgMgr: a.proxyConfig, CfgMgr: a.proxyConfig,
Authz: a, Authz: a,
@ -744,15 +741,15 @@ func (a *Agent) listenAndServeGRPC() error {
CheckFetcher: a, CheckFetcher: a,
CfgFetcher: a, CfgFetcher: a,
} }
a.xdsServer.Initialize() xdsServer.Initialize()
var err error var err error
if a.config.HTTPSPort > 0 { if a.config.HTTPSPort > 0 {
// gRPC uses the same TLS settings as the HTTPS API. If HTTPS is // gRPC uses the same TLS settings as the HTTPS API. If HTTPS is
// enabled then gRPC will require HTTPS as well. // enabled then gRPC will require HTTPS as well.
a.grpcServer, err = a.xdsServer.GRPCServer(a.tlsConfigurator) a.grpcServer, err = xdsServer.GRPCServer(a.tlsConfigurator)
} else { } else {
a.grpcServer, err = a.xdsServer.GRPCServer(nil) a.grpcServer, err = xdsServer.GRPCServer(nil)
} }
if err != nil { if err != nil {
return err return err