Skip to content

Commit

Permalink
fix: dial issue
Browse files Browse the repository at this point in the history
Signed-off-by: l1b0k <[email protected]>
  • Loading branch information
l1b0k committed Jul 18, 2024
1 parent 3aba8b9 commit a91e2c1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/terway-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var (
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// create connection and grpc client
ctx, contextCancel = context.WithTimeout(context.Background(), connTimeout)
conn, err := grpc.NewClient(defaultSocketPath, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(
conn, err := grpc.NewClient("passthrough:"+defaultSocketPath, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(

Check warning on line 37 in cmd/terway-cli/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/terway-cli/main.go#L37

Added line #L37 was not covered by tests
func(ctx context.Context, s string) (net.Conn, error) {
unixAddr, err := net.ResolveUnixAddr("unix", defaultSocketPath)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions deviceplugin/eni.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"time"

"github.com/samber/lo"

"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
Expand Down Expand Up @@ -86,7 +85,7 @@ func NewENIDevicePlugin(count int, eniType string) *ENIDevicePlugin {

// dial establishes the gRPC communication with the registered device plugin.
func dial(unixSocketPath string, timeout time.Duration) (*grpc.ClientConn, func(), error) {
c, err := grpc.NewClient(unixSocketPath, grpc.WithTransportCredentials(insecure.NewCredentials()),
c, err := grpc.NewClient("passthrough:"+unixSocketPath, grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
return net.DialTimeout("unix", addr, timeout)
}))
Expand Down
2 changes: 1 addition & 1 deletion plugin/terway/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func cmdCheck(args *skel.CmdArgs) error {
}

func getNetworkClient(ctx context.Context) (rpc.TerwayBackendClient, *grpc.ClientConn, error) {
conn, err := grpc.NewClient(defaultSocketPath, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(
conn, err := grpc.NewClient("passthrough:"+defaultSocketPath, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(
func(ctx context.Context, s string) (net.Conn, error) {
unixAddr, err := net.ResolveUnixAddr("unix", s)
if err != nil {
Expand Down

0 comments on commit a91e2c1

Please sign in to comment.