Skip to content

Commit

Permalink
[admin_api] minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl committed Mar 16, 2021
1 parent a578db3 commit cee7a35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

// Package admin implements the admin service. It is a convenient API to expose
// states in the gRPC library.
//
// Notice: This package is EXPERIMENTAL and may be changed or removed in a later
// release.
package admin

import (
Expand All @@ -41,7 +44,7 @@ func init() {
// allocated for the service handlers.
//
// Note that if the server is not a *grpc.Server or a *xds.GRPCServer, CSDS will
// not be registered due to CSDS generated code is too old and doesn't support
// not be registered because CSDS generated code is old and doesn't support
// interface `grpc.ServiceRegistrar`.
// https://github.com/envoyproxy/go-control-plane/issues/403
func Register(s grpc.ServiceRegistrar) (cleanup func(), _ error) {
Expand Down
8 changes: 6 additions & 2 deletions xds/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ func init() {
case *GRPCServer:
sss, ok := ss.gs.(*grpc.Server)
if !ok {
return nil, fmt.Errorf("grpc server within xds.GRPCServer is not *grpc.Server, CSDS will not be registered")
logger.Warningf("grpc server within xds.GRPCServer is not *grpc.Server, CSDS will not be registered")
return nil, nil
}
grpcServer = sss
default:
return nil, fmt.Errorf("server to register service on is neither a *grpc.Server or a *xds.GRPCServer, CSDS will not be registered")
// Returning an error would cause the top level admin.Register() to
// fail. Log a warning instead.
logger.Warningf("server to register service on is neither a *grpc.Server or a *xds.GRPCServer, CSDS will not be registered")
return nil, nil
}

csdss, err := csds.NewClientStatusDiscoveryServer()
Expand Down

0 comments on commit cee7a35

Please sign in to comment.