controlplane: save configuration events to databroker (#2153)

* envoy: save events to databroker

* controlplane: add tests for envoy configuration events

* format imports
This commit is contained in:
Caleb Doxsey 2021-04-29 15:51:46 -06:00 committed by GitHub
parent d32b8a4d8a
commit 0adbf4f24c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1067 additions and 618 deletions

View file

@ -59,8 +59,7 @@ type Options struct {
}
// NewGRPCClientConn returns a new gRPC pomerium service client connection.
func NewGRPCClientConn(opts *Options, other ...grpc.DialOption) (*grpc.ClientConn, error) {
ctx := context.TODO()
func NewGRPCClientConn(ctx context.Context, opts *Options, other ...grpc.DialOption) (*grpc.ClientConn, error) {
if len(opts.Addrs) == 0 {
return nil, errors.New("internal/grpc: connection address required")
}
@ -130,7 +129,7 @@ func NewGRPCClientConn(opts *Options, other ...grpc.DialOption) (*grpc.ClientCon
dialOptions = append(dialOptions, grpc.WithTransportCredentials(cert))
}
return grpc.Dial(connAddr, dialOptions...)
return grpc.DialContext(ctx, connAddr, dialOptions...)
}
// grpcTimeoutInterceptor enforces per-RPC request timeouts
@ -160,7 +159,7 @@ var grpcClientConns = struct {
// GetGRPCClientConn returns a gRPC client connection for the given name. If a connection for that name has already been
// established the existing connection will be returned. If any options change for that connection, the existing
// connection will be closed and a new one established.
func GetGRPCClientConn(name string, opts *Options) (*grpc.ClientConn, error) {
func GetGRPCClientConn(ctx context.Context, name string, opts *Options) (*grpc.ClientConn, error) {
grpcClientConns.Lock()
defer grpcClientConns.Unlock()
@ -176,7 +175,7 @@ func GetGRPCClientConn(name string, opts *Options) (*grpc.ClientConn, error) {
}
}
cc, err := NewGRPCClientConn(opts)
cc, err := NewGRPCClientConn(ctx, opts)
if err != nil {
return nil, err
}