From 15b68c48d56d7989bbdb5bad7c368bd781ed829a Mon Sep 17 00:00:00 2001 From: Rokibul Hasan Date: Wed, 6 Nov 2024 12:36:48 +0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20`single-use=20dialer=20alr?= =?UTF-8?q?eady=20dialed`=20issue=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix `single-use dialer already dialed` issue Signed-off-by: Rokibul Hasan * Use `CreateSingleUseGrpcTunnelWithContext()` Signed-off-by: Rokibul Hasan --------- Signed-off-by: Rokibul Hasan --- pkg/cmd/proxy/health/exec.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/cmd/proxy/health/exec.go b/pkg/cmd/proxy/health/exec.go index eab5b1f5..9497cfee 100644 --- a/pkg/cmd/proxy/health/exec.go +++ b/pkg/cmd/proxy/health/exec.go @@ -148,19 +148,20 @@ func (o *Options) run(streams genericiooptions.IOStreams) error { return errors.Wrapf(err, "failed building tls config") } - tunnel, err := konnectivity.CreateSingleUseGrpcTunnel( - ctx, - net.JoinHostPort(o.proxyServerHost, strconv.Itoa(o.proxyServerPort)), - grpc.WithTransportCredentials(grpccredentials.NewTLS(tlsCfg)), - ) - if err != nil { - return errors.Wrapf(err, "failed starting konnectivity proxy") - } - probingClusters := o.ClusterOption.AllClusters() w := newWriter(streams) for _, cluster := range managedClusterList.Items { if probingClusters.Len() == 0 || probingClusters.Has(cluster.Name) { + tunnel, err := konnectivity.CreateSingleUseGrpcTunnelWithContext( + context.TODO(), + ctx, + net.JoinHostPort(o.proxyServerHost, strconv.Itoa(o.proxyServerPort)), + grpc.WithTransportCredentials(grpccredentials.NewTLS(tlsCfg)), + ) + if err != nil { + return errors.Wrapf(err, "failed starting konnectivity proxy") + } + if err := o.visit(&w, hubRestConfig, addonClient, tunnel.DialContext, cluster.Name); err != nil { klog.Errorf("An error occurred when requesting: %v", err) }