1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-05 08:17:04 +00:00

nfd-worker: drop deprecated grpc.WithTimeout

This commit is contained in:
Markus Lehtonen 2020-05-19 15:07:31 +03:00
parent 91f3ddcc45
commit c7b1d67b6b

View file

@ -188,7 +188,9 @@ func (w *nfdWorker) connect() error {
} }
// Dial and create a client // Dial and create a client
dialOpts := []grpc.DialOption{grpc.WithBlock(), grpc.WithTimeout(60 * time.Second)} dialCtx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
dialOpts := []grpc.DialOption{grpc.WithBlock()}
if w.args.CaFile != "" || w.args.CertFile != "" || w.args.KeyFile != "" { if w.args.CaFile != "" || w.args.CertFile != "" || w.args.KeyFile != "" {
// Load client cert for client authentication // Load client cert for client authentication
cert, err := tls.LoadX509KeyPair(w.args.CertFile, w.args.KeyFile) cert, err := tls.LoadX509KeyPair(w.args.CertFile, w.args.KeyFile)
@ -214,7 +216,7 @@ func (w *nfdWorker) connect() error {
} else { } else {
dialOpts = append(dialOpts, grpc.WithInsecure()) dialOpts = append(dialOpts, grpc.WithInsecure())
} }
conn, err := grpc.Dial(w.args.Server, dialOpts...) conn, err := grpc.DialContext(dialCtx, w.args.Server, dialOpts...)
if err != nil { if err != nil {
return err return err
} }