treewide: replace deprecated grpc.Dial with grpc.NewClient
Change-Id: I925912ca1ee01d547fd9c1813eb083a2cd9a590a
Reviewed-on: https://review.monogon.dev/c/monogon/+/3858
Reviewed-by: Jan Schär <jan@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/cli/metroctl/core/ca_tofu.go b/metropolis/cli/metroctl/core/ca_tofu.go
index 3f3c135..c19c303 100644
--- a/metropolis/cli/metroctl/core/ca_tofu.go
+++ b/metropolis/cli/metroctl/core/ca_tofu.go
@@ -156,9 +156,9 @@
return nil, err
}
opts = append(opts, grpc.WithTransportCredentials(creds))
- cc, err := grpc.Dial(resolver.MetropolisControlAddress, opts...)
+ cc, err := grpc.NewClient(resolver.MetropolisControlAddress, opts...)
if err != nil {
- return nil, fmt.Errorf("while dialing cluster to retrieve CA: %w", err)
+ return nil, fmt.Errorf("while creating grpc client: %w", err)
}
cur := ipb.NewCuratorLocalClient(cc)
res, err := cur.GetCACertificate(ctx, &ipb.GetCACertificateRequest{})
diff --git a/metropolis/cli/metroctl/core/rpc.go b/metropolis/cli/metroctl/core/rpc.go
index 8b377f5..a8f933c 100644
--- a/metropolis/cli/metroctl/core/rpc.go
+++ b/metropolis/cli/metroctl/core/rpc.go
@@ -53,7 +53,7 @@
return opts, nil
}
-func DialNode(ctx context.Context, opkey ed25519.PrivateKey, ocert, ca *x509.Certificate, proxyAddr, nodeId, nodeAddr string) (*grpc.ClientConn, error) {
+func NewNodeClient(ctx context.Context, opkey ed25519.PrivateKey, ocert, ca *x509.Certificate, proxyAddr, nodeId, nodeAddr string) (*grpc.ClientConn, error) {
var dialOpts []grpc.DialOption
if opkey == nil {
@@ -77,7 +77,7 @@
dialOpts = append(dialOpts, grpc.WithTransportCredentials(creds))
endpoint := net.JoinHostPort(nodeAddr, node.NodeManagementPort.PortString())
- return grpc.Dial(endpoint, dialOpts...)
+ return grpc.NewClient(endpoint, dialOpts...)
}
// GetNodes retrieves node records, filtered by the supplied node filter