Various cleanups.

This commit is contained in:
Derek Menteer 2022-09-08 10:51:50 -05:00
parent b50bc443f3
commit 6aaf1c6035
3 changed files with 11 additions and 16 deletions

View File

@ -213,7 +213,7 @@ type Agent struct {
// depending on the configuration
delegate delegate
// externalGRPCServer is the gRPC server exposed on a dedicated gRPC port (as
// externalGRPCServer is the gRPC server exposed on dedicated gRPC ports (as
// opposed to the multiplexed "server" port).
externalGRPCServer *grpc.Server
@ -702,7 +702,7 @@ func (a *Agent) Start(ctx context.Context) error {
a.apiServers.Start(srv)
}
// Start gRPC and gRPC+TLS servers.
// Start grpc and grpc_tls servers.
if err := a.listenAndServeGRPC(); err != nil {
return err
}

View File

@ -706,7 +706,7 @@ type RuntimeConfig struct {
// go-sockaddr templates. UNIX socket paths must be written as
// 'unix://<full path>', e.g. 'unix:///var/run/consul-grpc.sock'.
//
// If 'addresses.grpc' was not provided the 'client_addr' addresses are
// If 'addresses.grpc_tls' was not provided the 'client_addr' addresses are
// used.
//
// hcl: client_addr = string addresses { grpc_tls = string } ports { grpc_tls = int }

View File

@ -253,7 +253,7 @@ type Server struct {
// enable RPC forwarding.
externalConnectCAServer *connectca.Server
// externalGRPCServers has a gRPC server exposed on the dedicated gRPC ports, as
// externalGRPCServer has a gRPC server exposed on the dedicated gRPC ports, as
// opposed to the multiplexed "server" port which is served by grpcHandler.
externalGRPCServer *grpc.Server
@ -377,9 +377,6 @@ type Server struct {
// embedded struct to hold all the enterprise specific data
EnterpriseServer
}
type GRPCService interface {
Register(*grpc.Server)
}
type connHandler interface {
Run() error
Handle(conn net.Conn)
@ -698,7 +695,7 @@ func NewServer(config *Config, flat Deps, externalGRPCServer *grpc.Server) (*Ser
PrimaryDatacenter: s.config.PrimaryDatacenter,
ValidateEnterpriseRequest: s.validateEnterpriseRequest,
})
s.externalACLServer.Register(externalGRPCServer)
s.externalACLServer.Register(s.externalGRPCServer)
s.externalConnectCAServer = connectca.NewServer(connectca.Config{
Publisher: s.publisher,
@ -711,22 +708,20 @@ func NewServer(config *Config, flat Deps, externalGRPCServer *grpc.Server) (*Ser
},
ConnectEnabled: s.config.ConnectEnabled,
})
s.externalConnectCAServer.Register(externalGRPCServer)
s.externalConnectCAServer.Register(s.externalGRPCServer)
dataplaneServer := dataplane.NewServer(dataplane.Config{
dataplane.NewServer(dataplane.Config{
GetStore: func() dataplane.StateStore { return s.FSM().State() },
Logger: logger.Named("grpc-api.dataplane"),
ACLResolver: s.ACLResolver,
Datacenter: s.config.Datacenter,
})
dataplaneServer.Register(externalGRPCServer)
}).Register(s.externalGRPCServer)
serverDiscoveryServer := serverdiscovery.NewServer(serverdiscovery.Config{
serverdiscovery.NewServer(serverdiscovery.Config{
Publisher: s.publisher,
ACLResolver: s.ACLResolver,
Logger: logger.Named("grpc-api.server-discovery"),
})
serverDiscoveryServer.Register(externalGRPCServer)
}).Register(s.externalGRPCServer)
s.peeringBackend = NewPeeringBackend(s)
s.peerStreamServer = peerstream.NewServer(peerstream.Config{
@ -744,7 +739,7 @@ func NewServer(config *Config, flat Deps, externalGRPCServer *grpc.Server) (*Ser
return s.ForwardGRPC(s.grpcConnPool, info, fn)
},
})
s.peerStreamServer.Register(externalGRPCServer)
s.peerStreamServer.Register(s.externalGRPCServer)
// Initialize internal gRPC server.
//