Various cleanups.
This commit is contained in:
parent
b50bc443f3
commit
6aaf1c6035
|
@ -213,7 +213,7 @@ type Agent struct {
|
||||||
// depending on the configuration
|
// depending on the configuration
|
||||||
delegate delegate
|
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).
|
// opposed to the multiplexed "server" port).
|
||||||
externalGRPCServer *grpc.Server
|
externalGRPCServer *grpc.Server
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ func (a *Agent) Start(ctx context.Context) error {
|
||||||
a.apiServers.Start(srv)
|
a.apiServers.Start(srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start gRPC and gRPC+TLS servers.
|
// Start grpc and grpc_tls servers.
|
||||||
if err := a.listenAndServeGRPC(); err != nil {
|
if err := a.listenAndServeGRPC(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -706,7 +706,7 @@ type RuntimeConfig struct {
|
||||||
// go-sockaddr templates. UNIX socket paths must be written as
|
// go-sockaddr templates. UNIX socket paths must be written as
|
||||||
// 'unix://<full path>', e.g. 'unix:///var/run/consul-grpc.sock'.
|
// '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.
|
// used.
|
||||||
//
|
//
|
||||||
// hcl: client_addr = string addresses { grpc_tls = string } ports { grpc_tls = int }
|
// hcl: client_addr = string addresses { grpc_tls = string } ports { grpc_tls = int }
|
||||||
|
|
|
@ -253,7 +253,7 @@ type Server struct {
|
||||||
// enable RPC forwarding.
|
// enable RPC forwarding.
|
||||||
externalConnectCAServer *connectca.Server
|
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.
|
// opposed to the multiplexed "server" port which is served by grpcHandler.
|
||||||
externalGRPCServer *grpc.Server
|
externalGRPCServer *grpc.Server
|
||||||
|
|
||||||
|
@ -377,9 +377,6 @@ type Server struct {
|
||||||
// embedded struct to hold all the enterprise specific data
|
// embedded struct to hold all the enterprise specific data
|
||||||
EnterpriseServer
|
EnterpriseServer
|
||||||
}
|
}
|
||||||
type GRPCService interface {
|
|
||||||
Register(*grpc.Server)
|
|
||||||
}
|
|
||||||
type connHandler interface {
|
type connHandler interface {
|
||||||
Run() error
|
Run() error
|
||||||
Handle(conn net.Conn)
|
Handle(conn net.Conn)
|
||||||
|
@ -698,7 +695,7 @@ func NewServer(config *Config, flat Deps, externalGRPCServer *grpc.Server) (*Ser
|
||||||
PrimaryDatacenter: s.config.PrimaryDatacenter,
|
PrimaryDatacenter: s.config.PrimaryDatacenter,
|
||||||
ValidateEnterpriseRequest: s.validateEnterpriseRequest,
|
ValidateEnterpriseRequest: s.validateEnterpriseRequest,
|
||||||
})
|
})
|
||||||
s.externalACLServer.Register(externalGRPCServer)
|
s.externalACLServer.Register(s.externalGRPCServer)
|
||||||
|
|
||||||
s.externalConnectCAServer = connectca.NewServer(connectca.Config{
|
s.externalConnectCAServer = connectca.NewServer(connectca.Config{
|
||||||
Publisher: s.publisher,
|
Publisher: s.publisher,
|
||||||
|
@ -711,22 +708,20 @@ func NewServer(config *Config, flat Deps, externalGRPCServer *grpc.Server) (*Ser
|
||||||
},
|
},
|
||||||
ConnectEnabled: s.config.ConnectEnabled,
|
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() },
|
GetStore: func() dataplane.StateStore { return s.FSM().State() },
|
||||||
Logger: logger.Named("grpc-api.dataplane"),
|
Logger: logger.Named("grpc-api.dataplane"),
|
||||||
ACLResolver: s.ACLResolver,
|
ACLResolver: s.ACLResolver,
|
||||||
Datacenter: s.config.Datacenter,
|
Datacenter: s.config.Datacenter,
|
||||||
})
|
}).Register(s.externalGRPCServer)
|
||||||
dataplaneServer.Register(externalGRPCServer)
|
|
||||||
|
|
||||||
serverDiscoveryServer := serverdiscovery.NewServer(serverdiscovery.Config{
|
serverdiscovery.NewServer(serverdiscovery.Config{
|
||||||
Publisher: s.publisher,
|
Publisher: s.publisher,
|
||||||
ACLResolver: s.ACLResolver,
|
ACLResolver: s.ACLResolver,
|
||||||
Logger: logger.Named("grpc-api.server-discovery"),
|
Logger: logger.Named("grpc-api.server-discovery"),
|
||||||
})
|
}).Register(s.externalGRPCServer)
|
||||||
serverDiscoveryServer.Register(externalGRPCServer)
|
|
||||||
|
|
||||||
s.peeringBackend = NewPeeringBackend(s)
|
s.peeringBackend = NewPeeringBackend(s)
|
||||||
s.peerStreamServer = peerstream.NewServer(peerstream.Config{
|
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)
|
return s.ForwardGRPC(s.grpcConnPool, info, fn)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
s.peerStreamServer.Register(externalGRPCServer)
|
s.peerStreamServer.Register(s.externalGRPCServer)
|
||||||
|
|
||||||
// Initialize internal gRPC server.
|
// Initialize internal gRPC server.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue