Skip to content

Commit

Permalink
add dialTimeout for cmd-forwarder-vpp (#393)
Browse files Browse the repository at this point in the history
Signed-off-by: denis-tingaikin <denis.tingajkin@xored.com>
  • Loading branch information
denis-tingaikin authored Nov 10, 2021
1 parent 20aca93 commit 273c97b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/networkservicemesh/sdk v0.5.1-0.20211110200317-2272de7cade7
github.com/networkservicemesh/sdk-k8s v0.0.0-20211103091718-33b5af79cf03
github.com/networkservicemesh/sdk-sriov v0.0.0-20211103092011-23a720ab62a6
github.com/networkservicemesh/sdk-vpp v0.0.0-20211110200900-b81956c63fbd
github.com/networkservicemesh/sdk-vpp v0.0.0-20211110233207-dd1c00b6ebb2
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.7.0
github.com/spiffe/go-spiffe/v2 v2.0.0-beta.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ github.com/networkservicemesh/sdk-kernel v0.0.0-20211110200529-c70dbe94eb13 h1:P
github.com/networkservicemesh/sdk-kernel v0.0.0-20211110200529-c70dbe94eb13/go.mod h1:Oz6lGHKKSFyJXcTql3dRfufM8k/4idlQ5A4Do+DdbBE=
github.com/networkservicemesh/sdk-sriov v0.0.0-20211103092011-23a720ab62a6 h1:WsnwJeTDbTVJc8FuCYIUt6y9QnYaRrEyH3TCycQGDRo=
github.com/networkservicemesh/sdk-sriov v0.0.0-20211103092011-23a720ab62a6/go.mod h1:Sx4W7rd93sUhpCPT92FvhDXAbbfshVcB4IX4CgTrFos=
github.com/networkservicemesh/sdk-vpp v0.0.0-20211110200900-b81956c63fbd h1:+I9jnfpRWiv23Q9r5zGfBUi4CTwqjx3V29KmMUpOcuY=
github.com/networkservicemesh/sdk-vpp v0.0.0-20211110200900-b81956c63fbd/go.mod h1:6blhu3JzeEHEOeA8lUhQ4JYHUOB0xthiiaZEuTQ71NI=
github.com/networkservicemesh/sdk-vpp v0.0.0-20211110233207-dd1c00b6ebb2 h1:USJRlkP9tYXpzqxjx88edzqUDrTwyuuwe4aN/oat2q8=
github.com/networkservicemesh/sdk-vpp v0.0.0-20211110233207-dd1c00b6ebb2/go.mod h1:6blhu3JzeEHEOeA8lUhQ4JYHUOB0xthiiaZEuTQ71NI=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Config struct {
ListenOn url.URL `default:"unix:///listen.on.socket" desc:"url to listen on" split_words:"true"`
MaxTokenLifetime time.Duration `default:"10m" desc:"maximum lifetime of tokens" split_words:"true"`
LogLevel string `default:"INFO" desc:"Log level" split_words:"true"`
DialTimeout time.Duration `default:"50ms" desc:"Timeout for the dial the next endpoint" split_words:"true"`

TunnelIP net.IP `desc:"IP to use for tunnels" split_words:"true"`
VxlanPort uint16 `default:"0" desc:"VXLAN port to use" split_words:"true"`
Expand Down
4 changes: 3 additions & 1 deletion internal/xconnectns/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"context"
"net"
"net/url"
"time"

"google.golang.org/grpc"

Expand Down Expand Up @@ -58,9 +59,10 @@ func NewServer(
sriovConfig *sriovconfig.Config,
vfioDir, cgroupBaseDir string,
clientURL *url.URL,
dialTimeout time.Duration,
clientDialOptions ...grpc.DialOption,
) endpoint.Endpoint {
vppForwarder := vppforwarder.NewServer(ctx, name, authzServer, tokenGenerator, clientURL, vppConn, tunnelIP, tunnelPort, clientDialOptions...)
vppForwarder := vppforwarder.NewServer(ctx, name, authzServer, tokenGenerator, clientURL, vppConn, tunnelIP, tunnelPort, dialTimeout, clientDialOptions...)
if sriovConfig == nil {
return vppForwarder
}
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ func main() {
sriovConfig,
cfg.VFIOPath, cfg.CgroupPath,
&cfg.ConnectTo,
cfg.DialTimeout,
grpc.WithTransportCredentials(
grpcfd.TransportCredentials(credentials.NewTLS(tlsconfig.MTLSClientConfig(source, source, tlsconfig.AuthorizeAny())))),
grpc.WithDefaultCallOptions(
Expand Down

0 comments on commit 273c97b

Please sign in to comment.