Skip to content

Commit daa6083

Browse files
authored
Merge pull request #118 from yjinjo/master
Modify api_resources for grpc://
2 parents 32e35fc + 1cfb3f5 commit daa6083

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/common/api_resources.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,15 @@ func FetchServiceResources(serviceName, endpoint string, shortNamesMap map[strin
103103
creds := credentials.NewTLS(tlsConfig)
104104
opts = append(opts, grpc.WithTransportCredentials(creds))
105105
} else if scheme == "grpc" {
106-
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
106+
if strings.Contains(hostPort, ".svc.cluster.local") {
107+
tlsConfig := &tls.Config{
108+
InsecureSkipVerify: true,
109+
}
110+
creds := credentials.NewTLS(tlsConfig)
111+
opts = append(opts, grpc.WithTransportCredentials(creds))
112+
} else {
113+
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
114+
}
107115
} else {
108116
return nil, fmt.Errorf("unsupported scheme: %s", scheme)
109117
}

0 commit comments

Comments
 (0)