Skip to content

Commit

Permalink
🐛 Fix single-use dialer already dialed issue (open-cluster-manageme…
Browse files Browse the repository at this point in the history
…nt-io#458)

* Fix `single-use dialer already dialed` issue

Signed-off-by: Rokibul Hasan <[email protected]>

* Use `CreateSingleUseGrpcTunnelWithContext()`

Signed-off-by: Rokibul Hasan <[email protected]>

---------

Signed-off-by: Rokibul Hasan <[email protected]>
  • Loading branch information
RokibulHasan7 authored Nov 6, 2024
1 parent 198563c commit 15b68c4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pkg/cmd/proxy/health/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 15b68c4

Please sign in to comment.