From 6aaf1c6035970f76f1e685fa40f5e69a59587654 Mon Sep 17 00:00:00 2001 From: Derek Menteer Date: Thu, 8 Sep 2022 10:51:50 -0500 Subject: [PATCH] Various cleanups. --- agent/agent.go | 4 ++-- agent/config/runtime.go | 2 +- agent/consul/server.go | 21 ++++++++------------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index e1ea30547..dbc104403 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -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 } diff --git a/agent/config/runtime.go b/agent/config/runtime.go index f5601480d..ee82ea477 100644 --- a/agent/config/runtime.go +++ b/agent/config/runtime.go @@ -706,7 +706,7 @@ type RuntimeConfig struct { // go-sockaddr templates. UNIX socket paths must be written as // 'unix://', 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 } diff --git a/agent/consul/server.go b/agent/consul/server.go index 59c0e132f..b6e77a4a1 100644 --- a/agent/consul/server.go +++ b/agent/consul/server.go @@ -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. //