Skip to content

Commit

Permalink
service: use DialContext in custom dialer
Browse files Browse the repository at this point in the history
Currently, the custom dialer ignores the context it is passed to. Let's
switch to using DialContext, so that we properly propagate it. This
mimics also the default behavior when no custom dialer is configured [1].

[1] vendor/google.golang.org/grpc/internal/transport/http2_client.go:179

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
  • Loading branch information
giorio94 authored and borkmann committed Jul 7, 2023
1 parent a361b2d commit ad76862
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/k8s/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,6 @@ func CreateCustomDialer(b ServiceIPGetter, log *logrus.Entry, verboseLogs bool)
}

log.Debugf("Custom dialer based on k8s service backend is dialing to %q", s)
return net.Dial("tcp", s)
return (&net.Dialer{}).DialContext(ctx, "tcp", s)
}
}

0 comments on commit ad76862

Please sign in to comment.