From b51085304c5ddd3ea6bb1bd019eb2c642a6d1f9d Mon Sep 17 00:00:00 2001 From: NikitaSkrynnik Date: Fri, 29 Nov 2024 21:23:40 +1100 Subject: [PATCH 1/3] Update vpphelper manually Signed-off-by: NikitaSkrynnik --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 857fc7b..719bed7 100644 --- a/main.go +++ b/main.go @@ -40,6 +40,7 @@ import ( "github.com/sirupsen/logrus" "github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig" "github.com/spiffe/go-spiffe/v2/workloadapi" + "go.fd.io/govpp/api" "google.golang.org/grpc" "google.golang.org/grpc/credentials" @@ -321,7 +322,7 @@ func main() { <-vppErrCh } -func createForwarder(ctx context.Context, cancel context.CancelFunc, config *Config, vppConn vpphelper.Connection, source *workloadapi.X509Source, tlsServerConfig *tls.Config, dialOptions ...grpc.DialOption) *url.URL { +func createForwarder(ctx context.Context, cancel context.CancelFunc, config *Config, vppConn api.Connection, source *workloadapi.X509Source, tlsServerConfig *tls.Config, dialOptions ...grpc.DialOption) *url.URL { gRPCOptions := append( tracing.WithTracing(), grpc.Creds( From 959d595dc52d8e0da705f2f3006ec46efa04bbd6 Mon Sep 17 00:00:00 2001 From: NikitaSkrynnik Date: Mon, 2 Dec 2024 20:16:19 +1100 Subject: [PATCH 2/3] use extended vpp connection Signed-off-by: NikitaSkrynnik --- README.md | 27 ++++++++++++++------------- main.go | 4 ++++ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b22b6d1..af188ba 100644 --- a/README.md +++ b/README.md @@ -20,19 +20,20 @@ docker build . ## Environment config -* `NSM_NAME` - Name of docker client -* `NSM_REQUEST_TIMEOUT` - timeout to request NSE -* `NSM_CONNECT_TO` - url to connect to -* `NSM_DIAL_TIMEOUT` - timeout to dial -* `NSM_MAX_TOKEN_LIFETIME` - maximum lifetime of tokens -* `NSM_TUNNEL_IP` - IP to use for tunnels -* `NSM_LABELS` - A list of client labels with format key1=val1,key2=val2, will be used a primary list for network services -* `NSM_NETWORK_SERVICES` - A list of Network Service Requests -* `NSM_FEDERATES_WITH` - Name of the federated domain -* `NSM_TRUST_DOMAIN` - Name of the trust domain -* `NSM_LOG_LEVEL` - Log level -* `NSM_PPROF_ENABLED` - is pprof enabled (default: "false") -* `NSM_PPROF_LISTEN_ON` - pprof URL to ListenAndServe (default: "localhost:6060") +* `NSM_NAME` - Name of docker client +* `NSM_REQUEST_TIMEOUT` - timeout to request NSE +* `NSM_CONNECT_TO` - url to connect to +* `NSM_DIAL_TIMEOUT` - timeout to dial +* `NSM_MAX_TOKEN_LIFETIME` - maximum lifetime of tokens +* `NSM_TUNNEL_IP` - IP to use for tunnels +* `NSM_LABELS` - A list of client labels with format key1=val1,key2=val2, will be used a primary list for network services +* `NSM_NETWORK_SERVICES` - A list of Network Service Requests +* `NSM_FEDERATES_WITH` - Name of the federated domain +* `NSM_TRUST_DOMAIN` - Name of the trust domain +* `NSM_LOG_LEVEL` - Log level +* `NSM_PPROF_ENABLED` - is pprof enabled (default: "false") +* `NSM_PPROF_LISTEN_ON` - pprof URL to ListenAndServe (default: "localhost:6060") +* `NSM_VPP_MIN_OPERATION_TIMEOUT` - minimum timeout for every vpp operation # Testing diff --git a/main.go b/main.go index 719bed7..e1ed0d1 100644 --- a/main.go +++ b/main.go @@ -45,6 +45,7 @@ import ( "google.golang.org/grpc/credentials" "github.com/networkservicemesh/vpphelper" + "github.com/networkservicemesh/vpphelper/extendtimeout" "github.com/networkservicemesh/api/pkg/api/networkservice" "github.com/networkservicemesh/sdk/pkg/networkservice/chains/client" @@ -99,6 +100,8 @@ type Config struct { PprofEnabled bool `default:"false" desc:"is pprof enabled" split_words:"true"` PprofListenOn string `default:"localhost:6060" desc:"pprof URL to ListenAndServe" split_words:"true"` + + VPPMinOperationTimeout time.Duration `default:"2s" desc:"minimum timeout for every vpp operation" split_words:"true"` } // Process prints and processes env to config @@ -204,6 +207,7 @@ func main() { <-vppErrCh }() config.TunnelIP = vppinit.Must(vppinit.LinkToAfPacket(ctx, vppConn, config.TunnelIP)) + vppConn = extendtimeout.NewConnection(vppConn, config.VPPMinOperationTimeout) // ******************************************************************************** log.FromContext(ctx).Info("executing phase 3: start spire-server and spire-agent") From 1c4914606bdce82fa90fe1257c4ecc7a74973470 Mon Sep 17 00:00:00 2001 From: NikitaSkrynnik Date: Mon, 2 Dec 2024 20:18:08 +1100 Subject: [PATCH 3/3] go gen Signed-off-by: NikitaSkrynnik --- go.mod | 2 +- go.sum | 4 ++-- internal/imports/imports_linux.go | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cd47beb..2cb8dac 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/networkservicemesh/sdk v0.5.1-0.20241227223757-422abe9bfbdd github.com/networkservicemesh/sdk-kernel v0.0.0-20241227224026-3bba51753247 github.com/networkservicemesh/sdk-vpp v0.0.0-20241227224413-166396795a3c - github.com/networkservicemesh/vpphelper v0.0.0-20240115135903-e2b961f768b6 + github.com/networkservicemesh/vpphelper v0.0.0-20241209033247-bcb5c25a9f29 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 github.com/spiffe/go-spiffe/v2 v2.1.7 diff --git a/go.sum b/go.sum index 53ca902..69e69ca 100644 --- a/go.sum +++ b/go.sum @@ -158,8 +158,8 @@ github.com/networkservicemesh/sdk-kernel v0.0.0-20241227224026-3bba51753247 h1:Z github.com/networkservicemesh/sdk-kernel v0.0.0-20241227224026-3bba51753247/go.mod h1:BEcSP25b0qmilHCYv5QtGtADOI4sU8eX/lJskK5O5fc= github.com/networkservicemesh/sdk-vpp v0.0.0-20241227224413-166396795a3c h1:sLos0zvQuAqbTjvIM0ZIJ+w0XE/RCDgrWfEz5N8zmPA= github.com/networkservicemesh/sdk-vpp v0.0.0-20241227224413-166396795a3c/go.mod h1:UeWHbi3ozPYRxoA2nlZNWsSDnsMCr4PM5abgtJO93iM= -github.com/networkservicemesh/vpphelper v0.0.0-20240115135903-e2b961f768b6 h1:o+enN5yCikNXZN+hO+JjE+aLxBWq9+GMVF9GSQtpwMI= -github.com/networkservicemesh/vpphelper v0.0.0-20240115135903-e2b961f768b6/go.mod h1:n6+8PnoDvWj6WMryfU3J8HOCusgysFjQ0kGLfrcsDEM= +github.com/networkservicemesh/vpphelper v0.0.0-20241209033247-bcb5c25a9f29 h1:hqYoTeQ9mFOIoKUMBXg779SU2yJWrrapucKgoPNZ1co= +github.com/networkservicemesh/vpphelper v0.0.0-20241209033247-bcb5c25a9f29/go.mod h1:Qc5x5poZk5cVzcHk4ZIL6+NMC95uoitsmmnl7X9V/Yw= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/open-policy-agent/opa v0.44.0 h1:sEZthsrWBqIN+ShTMJ0Hcz6a3GkYsY4FaB2S/ou2hZk= diff --git a/internal/imports/imports_linux.go b/internal/imports/imports_linux.go index eba9af8..4ca4cbb 100644 --- a/internal/imports/imports_linux.go +++ b/internal/imports/imports_linux.go @@ -44,6 +44,7 @@ import ( _ "github.com/networkservicemesh/sdk/pkg/tools/token" _ "github.com/networkservicemesh/sdk/pkg/tools/tracing" _ "github.com/networkservicemesh/vpphelper" + _ "github.com/networkservicemesh/vpphelper/extendtimeout" _ "github.com/pkg/errors" _ "github.com/sirupsen/logrus" _ "github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig"