Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: fix: remove deprecated grpc.WithBlock #490

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pkg/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,18 @@ func NewClient(ctx context.Context, config ClientConfiguration) (*Client, error)
return nil, errors.Wrap(err, "unable to create a dialer for etcd client")
}

// Use a specific context with a timeout for the etcd client
clientCtx, cancel := context.WithTimeout(context.Background(), config.DialTimeout)
defer cancel()

c := clientv3.Config{
// NOTE: endpoint is used only as a host for certificate validation, the network connection is defined by DialOptions.
Endpoints: []string{config.Endpoint},
DialTimeout: config.DialTimeout,
Endpoints: []string{config.Endpoint},
DialOptions: []grpc.DialOption{
grpc.WithBlock(), // block until the underlying connection is up
grpc.WithContextDialer(dialer.DialContextWithAddr),
},
TLS: config.TLSConfig,
TLS: config.TLSConfig,
Context: clientCtx,
}

etcdClient, err := clientv3.New(c)
Expand Down
Loading