From bbe821e5e51d8a7d51ff5a44ce896a826fea7c21 Mon Sep 17 00:00:00 2001 From: Vladimir Popov Date: Wed, 9 Jun 2021 16:17:31 +0700 Subject: [PATCH] Manually update to the latest sdk version Signed-off-by: Vladimir Popov --- go.mod | 4 +-- go.sum | 6 ++-- internal/imports/gen.go | 2 ++ internal/imports/imports_linux.go | 1 - main.go | 56 ++++++++++++------------------- 5 files changed, 29 insertions(+), 40 deletions(-) diff --git a/go.mod b/go.mod index 8dc4ad7..9eba8b7 100644 --- a/go.mod +++ b/go.mod @@ -9,8 +9,8 @@ require ( github.com/edwarnicke/vpphelper v0.0.0-20210225052320-b4f1f1aff45d github.com/google/uuid v1.1.2 github.com/kelseyhightower/envconfig v1.4.0 - github.com/networkservicemesh/api v0.0.0-20210607090113-57f36f2c295b - github.com/networkservicemesh/sdk v0.0.0-20210608053425-06aafeb2606f + github.com/networkservicemesh/api v0.0.0-20210609080649-aa4a0cc6c9ea + github.com/networkservicemesh/sdk v0.0.0-20210609081227-4199f461084e github.com/networkservicemesh/sdk-vpp v0.0.0-20210608053942-fa13426047ac github.com/onsi/gomega v1.10.1 // indirect github.com/sirupsen/logrus v1.7.0 diff --git a/go.sum b/go.sum index a47d57f..5651687 100644 --- a/go.sum +++ b/go.sum @@ -138,10 +138,12 @@ github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nats-io/stan.go v0.6.0/go.mod h1:eIcD5bi3pqbHT/xIIvXMwvzXYElgouBvaVRftaE+eac= -github.com/networkservicemesh/api v0.0.0-20210607090113-57f36f2c295b h1:+7wAqJikkh4iOTK67BwyXLvIjxcNg5oefdLN/VV8Rsk= github.com/networkservicemesh/api v0.0.0-20210607090113-57f36f2c295b/go.mod h1:B6meq/SWjWR6bGXZdXPfbOeaBK+T1JayLdtEJQCsXKU= -github.com/networkservicemesh/sdk v0.0.0-20210608053425-06aafeb2606f h1:n+9BqBg4ee9N0Qc2gYk8mJFmwUmeKabPjrr3VzvxZjs= +github.com/networkservicemesh/api v0.0.0-20210609080649-aa4a0cc6c9ea h1:Oz3k/v09FYoXiK7riuotF/vKDxCQBPc+GnwlGmppGds= +github.com/networkservicemesh/api v0.0.0-20210609080649-aa4a0cc6c9ea/go.mod h1:B6meq/SWjWR6bGXZdXPfbOeaBK+T1JayLdtEJQCsXKU= github.com/networkservicemesh/sdk v0.0.0-20210608053425-06aafeb2606f/go.mod h1:i8dwCdHWGOzIIANoUDER7ujrLRuNUGwpX1OGJC3OHqw= +github.com/networkservicemesh/sdk v0.0.0-20210609081227-4199f461084e h1:snqZQXckNMIsVPSL4V7GD2TFi6W2hpheigWc1UH5VJ0= +github.com/networkservicemesh/sdk v0.0.0-20210609081227-4199f461084e/go.mod h1:6URyucmK3kQQ45Eg7fo57zDtrwIceNx3wBA3OuqN4S8= github.com/networkservicemesh/sdk-vpp v0.0.0-20210608053942-fa13426047ac h1:XZzTYRUtFAjyQe9AJyn4SJDXh9v8tYZg/juJzf3bOPY= github.com/networkservicemesh/sdk-vpp v0.0.0-20210608053942-fa13426047ac/go.mod h1:70H1pfYSr4Wl6/lQ0h+BUnzCobjCGOgVWloeYfE/P9s= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= diff --git a/internal/imports/gen.go b/internal/imports/gen.go index f87688f..a80bdc7 100644 --- a/internal/imports/gen.go +++ b/internal/imports/gen.go @@ -14,7 +14,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package imports is used for generating list of imports to optimize use of docker build cache package imports +//go:generate bash -c "rm -rf imports*.go" //go:generate bash -c "cd $(mktemp -d) && GO111MODULE=on go get github.com/edwarnicke/imports-gen@v1.1.1" //go:generate bash -c "GOOS=linux ${GOPATH}/bin/imports-gen" diff --git a/internal/imports/imports_linux.go b/internal/imports/imports_linux.go index edd4a88..2d1a520 100644 --- a/internal/imports/imports_linux.go +++ b/internal/imports/imports_linux.go @@ -18,7 +18,6 @@ import ( _ "github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms/recvfd" _ "github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms/sendfd" _ "github.com/networkservicemesh/sdk/pkg/networkservice/utils/metadata" - _ "github.com/networkservicemesh/sdk/pkg/tools/grpcutils" _ "github.com/networkservicemesh/sdk/pkg/tools/log" _ "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" _ "github.com/networkservicemesh/sdk/pkg/tools/nsurl" diff --git a/main.go b/main.go index 44b965e..8d581e1 100644 --- a/main.go +++ b/main.go @@ -47,7 +47,6 @@ import ( "github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms/recvfd" "github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms/sendfd" "github.com/networkservicemesh/sdk/pkg/networkservice/utils/metadata" - "github.com/networkservicemesh/sdk/pkg/tools/grpcutils" "github.com/networkservicemesh/sdk/pkg/tools/log" "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" "github.com/networkservicemesh/sdk/pkg/tools/nsurl" @@ -88,14 +87,13 @@ func main() { } starttime := time.Now() // enumerating phases - log.FromContext(ctx).Infof("there are 6 phases which will be executed followed by a success message:") + log.FromContext(ctx).Infof("there are 5 phases which will be executed followed by a success message:") log.FromContext(ctx).Infof("the phases include:") log.FromContext(ctx).Infof("1: get config from environment") log.FromContext(ctx).Infof("2: run vpp and get a connection to it") log.FromContext(ctx).Infof("3: retrieve spiffe svid") - log.FromContext(ctx).Infof("4: create grpc connection") - log.FromContext(ctx).Infof("5: create network service client") - log.FromContext(ctx).Infof("6: connect to all passed services") + log.FromContext(ctx).Infof("4: create network service client") + log.FromContext(ctx).Infof("5: connect to all passed services") log.FromContext(ctx).Infof("a final success message with start time duration") // ******************************************************************************** log.FromContext(ctx).Infof("executing phase 1: get config from environment (time since start: %s)", time.Since(starttime)) @@ -133,42 +131,28 @@ func main() { log.FromContext(ctx).WithField("duration", time.Since(now)).Info("completed phase 3: retrieving svid") // ******************************************************************************** - log.FromContext(ctx).Infof("executing phase 4: create grpc connection (time since start: %s)", time.Since(starttime)) + log.FromContext(ctx).Infof("executing phase 4: create network service client (time since start: %s)", time.Since(starttime)) // ******************************************************************************** - dialCtx, cancel := context.WithTimeout(ctx, config.DialTimeout) - defer cancel() - - clientCC, err := grpc.DialContext( - dialCtx, - grpcutils.URLToTarget(&config.ConnectTo), - append(opentracing.WithTracingDial(), - grpc.WithDefaultCallOptions( - grpc.WaitForReady(true), - grpc.PerRPCCredentials(token.NewPerRPCCredentials(spiffejwt.TokenGeneratorFunc(source, config.MaxTokenLifetime))), - ), - grpc.WithTransportCredentials( - grpcfd.TransportCredentials( - credentials.NewTLS( - tlsconfig.MTLSClientConfig(source, source, tlsconfig.AuthorizeAny()), - ), + dialOptions := append(opentracing.WithTracingDial(), + grpc.WithDefaultCallOptions( + grpc.WaitForReady(true), + grpc.PerRPCCredentials(token.NewPerRPCCredentials(spiffejwt.TokenGeneratorFunc(source, config.MaxTokenLifetime))), + ), + grpc.WithTransportCredentials( + grpcfd.TransportCredentials( + credentials.NewTLS( + tlsconfig.MTLSClientConfig(source, source, tlsconfig.AuthorizeAny()), ), ), - grpcfd.WithChainStreamInterceptor(), - grpcfd.WithChainUnaryInterceptor(), - )..., + ), + grpcfd.WithChainStreamInterceptor(), + grpcfd.WithChainUnaryInterceptor(), ) - if err != nil { - logrus.Fatalf("error getting clientCC: %+v", err) - } - - // ******************************************************************************** - log.FromContext(ctx).Infof("executing phase 5: create network service client (time since start: %s)", time.Since(starttime)) - // ******************************************************************************** c := client.NewClient( ctx, - clientCC, + &config.ConnectTo, client.WithName(config.Name), client.WithAdditionalFunctionality( metadata.NewClient(), @@ -178,10 +162,12 @@ func main() { sendfd.NewClient(), recvfd.NewClient(), ), + client.WithDialTimeout(config.DialTimeout), + client.WithDialOptions(dialOptions...), ) // ******************************************************************************** - log.FromContext(ctx).Infof("executing phase 6: connect to all passed services (time since start: %s)", time.Since(starttime)) + log.FromContext(ctx).Infof("executing phase 5: connect to all passed services (time since start: %s)", time.Since(starttime)) // ******************************************************************************** for i := 0; i < len(config.NetworkServices); i++ { @@ -203,7 +189,7 @@ func main() { resp, err := c.Request(requestCtx, request) if err != nil { - log.FromContext(ctx).Fatalf("requset has failed: %v", err.Error()) + log.FromContext(ctx).Fatalf("request has failed: %v", err.Error()) } defer func() {