Skip to content

Commit 5179953

Browse files
committed
fix(dsr): change grpc resolver to passthrough
When we used DialContext() before it was deprecated, it manually set the default resolver to passthrough. NewClient() appears to not do this, and then several versions of grpc ago, they defaulted to the DNS resolver which broke our DSR implementation with CRI compatible container engines. I'm not 100% sure that there isn't a better way to specify this, but I spent 20 - 30 minutes poking around the gRPC code base and I don't think that I can see an easy way to do this outside of specifying it this way. Furthermore, the project itself seems to advocate for this approach in comments like those on: grpc/grpc-go#1846
1 parent 65a8030 commit 5179953

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/cri/remote_runtime.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ func NewRemoteRuntimeService(endpoint string, connectionTimeout time.Duration) (
4141

4242
klog.V(4).Infof("[RuntimeService] got endpoint %s (proto=%s, path=%s)", endpoint, proto, addr)
4343

44-
if proto != "unix" {
44+
if proto == "unix" {
45+
// Every since grpc.DialContext was deprecated, we no longer get the passthrough resolver for free, so we need
46+
// to add it manually. See: https://github.com/grpc/grpc-go/issues/1846 for more context
47+
addr = "passthrough:///" + addr
48+
} else {
4549
return nil, errors.New("[RuntimeService] only unix socket is currently supported")
4650
}
4751

0 commit comments

Comments
 (0)