From 77429b7a28bf5b51678518864c71e9b27f49da48 Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik Date: Tue, 6 Dec 2022 19:12:32 +1100 Subject: [PATCH 1/4] add registry/updatepath chain elements Signed-off-by: Nikita Skrynnik --- go.mod | 9 ++++---- go.sum | 21 ++++++++++--------- .../chains/registryk8s/registry-k8s.go | 11 +++++++++- .../chains/registryk8s/registry-k8s_test.go | 3 ++- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 90c9457..5c202a1 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/google/uuid v1.2.0 github.com/networkservicemesh/api v1.6.2-0.20221123101008-30ff0ca88ee8 - github.com/networkservicemesh/sdk v0.5.1-0.20221124104929-d83bdbd65e5a + github.com/networkservicemesh/sdk v0.5.1-0.20221205080356-9b1b773fbe13 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.0 github.com/stretchr/testify v1.8.0 @@ -43,6 +43,7 @@ require ( github.com/go-openapi/swag v0.19.14 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-jwt/jwt/v4 v4.2.0 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/go-cmp v0.5.8 // indirect github.com/google/gofuzz v1.1.0 // indirect @@ -78,10 +79,10 @@ require ( go.opentelemetry.io/otel/trace v1.9.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect - golang.org/x/net v0.0.0-20220907135653-1e95f45603a7 // indirect + golang.org/x/net v0.2.0 // indirect golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 // indirect - golang.org/x/sys v0.0.0-20220908164124-27713097b956 // indirect - golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + golang.org/x/sys v0.2.0 // indirect + golang.org/x/term v0.2.0 // indirect golang.org/x/text v0.5.0 // indirect golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 89b5305..6f6f7b9 100644 --- a/go.sum +++ b/go.sum @@ -130,6 +130,7 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= +github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= @@ -238,8 +239,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/networkservicemesh/api v1.6.2-0.20221123101008-30ff0ca88ee8 h1:243pLMg7+XD/794gnMlHRePyzxJJwECT+Gg9nAuiwTo= github.com/networkservicemesh/api v1.6.2-0.20221123101008-30ff0ca88ee8/go.mod h1:hOF2844BSstH1311oDMDgqqXS+kdc77htZNPRKl9mf8= -github.com/networkservicemesh/sdk v0.5.1-0.20221124104929-d83bdbd65e5a h1:cVAxQKXaUyEmzoCwoXEUuQ+JGm3usGk26fUZta10xSY= -github.com/networkservicemesh/sdk v0.5.1-0.20221124104929-d83bdbd65e5a/go.mod h1:wnkxc0GGaktCa8MaL49AmRbT4QZl+CNv9xPdMHBOfjk= +github.com/networkservicemesh/sdk v0.5.1-0.20221205080356-9b1b773fbe13 h1:3iLQtkr1VoEwzDK2LemlTDtIGe8nyroDKD86FOtreYc= +github.com/networkservicemesh/sdk v0.5.1-0.20221205080356-9b1b773fbe13/go.mod h1:KlA3LQ3lLDnV9Y1C3jOTX3GeOXdmk2oL6oPYz2slA88= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q= @@ -370,7 +371,7 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -400,8 +401,8 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220907135653-1e95f45603a7 h1:1WGATo9HAhkWMbfyuVU0tEFP88OIkUvwaHFveQPvzCQ= -golang.org/x/net v0.0.0-20220907135653-1e95f45603a7/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -451,11 +452,11 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956 h1:XeJjHH1KiLpKGb6lvMiksZ9l0fVUh+AmGcm0nOMEBOY= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -513,7 +514,7 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= +golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/registry/chains/registryk8s/registry-k8s.go b/pkg/registry/chains/registryk8s/registry-k8s.go index 4a35fc8..ccbb74f 100644 --- a/pkg/registry/chains/registryk8s/registry-k8s.go +++ b/pkg/registry/chains/registryk8s/registry-k8s.go @@ -33,11 +33,14 @@ import ( "github.com/networkservicemesh/sdk/pkg/registry/common/connect" "github.com/networkservicemesh/sdk/pkg/registry/common/dial" "github.com/networkservicemesh/sdk/pkg/registry/common/expire" + "github.com/networkservicemesh/sdk/pkg/registry/common/grpcmetadata" "github.com/networkservicemesh/sdk/pkg/registry/common/setpayload" "github.com/networkservicemesh/sdk/pkg/registry/common/setregistrationtime" + "github.com/networkservicemesh/sdk/pkg/registry/common/updatepath" "github.com/networkservicemesh/sdk/pkg/registry/core/chain" "github.com/networkservicemesh/sdk/pkg/registry/switchcase" "github.com/networkservicemesh/sdk/pkg/tools/interdomain" + "github.com/networkservicemesh/sdk/pkg/tools/token" "github.com/networkservicemesh/sdk/pkg/registry/common/begin" @@ -91,7 +94,7 @@ func WithAuthorizeNSERegistryServer(authorizeNSERegistryServer registry.NetworkS } // NewServer creates new registry server based on k8s etcd db storage -func NewServer(config *Config, options ...Option) registryserver.Registry { +func NewServer(config *Config, tokenGenerator token.GeneratorFunc, options ...Option) registryserver.Registry { opts := &serverOptions{ authorizeNSRegistryServer: registryauthorize.NewNetworkServiceRegistryServer(registryauthorize.Any()), authorizeNSERegistryServer: registryauthorize.NewNetworkServiceEndpointRegistryServer(registryauthorize.Any()), @@ -101,6 +104,8 @@ func NewServer(config *Config, options ...Option) registryserver.Registry { } nseChain := chain.NewNetworkServiceEndpointRegistryServer( + grpcmetadata.NewNetworkServiceEndpointRegistryServer(), + updatepath.NewNetworkServiceEndpointRegistryServer(tokenGenerator), begin.NewNetworkServiceEndpointRegistryServer(), opts.authorizeNSERegistryServer, switchcase.NewNetworkServiceEndpointRegistryServer(switchcase.NSEServerCase{ @@ -121,6 +126,7 @@ func NewServer(config *Config, options ...Option) registryserver.Registry { begin.NewNetworkServiceEndpointRegistryClient(), clienturl.NewNetworkServiceEndpointRegistryClient(config.ProxyRegistryURL), clientconn.NewNetworkServiceEndpointRegistryClient(), + grpcmetadata.NewNetworkServiceEndpointRegistryClient(), dial.NewNetworkServiceEndpointRegistryClient(config.ChainCtx, dial.WithDialOptions(opts.dialOptions...), ), @@ -140,6 +146,8 @@ func NewServer(config *Config, options ...Option) registryserver.Registry { ), ) nsChain := chain.NewNetworkServiceRegistryServer( + grpcmetadata.NewNetworkServiceRegistryServer(), + updatepath.NewNetworkServiceRegistryServer(tokenGenerator), opts.authorizeNSRegistryServer, setpayload.NewNetworkServiceRegistryServer(), switchcase.NewNetworkServiceRegistryServer( @@ -152,6 +160,7 @@ func NewServer(config *Config, options ...Option) registryserver.Registry { clienturl.NewNetworkServiceRegistryClient(config.ProxyRegistryURL), begin.NewNetworkServiceRegistryClient(), clientconn.NewNetworkServiceRegistryClient(), + grpcmetadata.NewNetworkServiceRegistryClient(), dial.NewNetworkServiceRegistryClient(config.ChainCtx, dial.WithDialOptions(opts.dialOptions...), ), diff --git a/pkg/registry/chains/registryk8s/registry-k8s_test.go b/pkg/registry/chains/registryk8s/registry-k8s_test.go index be8253a..82b3832 100644 --- a/pkg/registry/chains/registryk8s/registry-k8s_test.go +++ b/pkg/registry/chains/registryk8s/registry-k8s_test.go @@ -36,6 +36,7 @@ import ( registryserver "github.com/networkservicemesh/sdk/pkg/registry" "github.com/networkservicemesh/sdk/pkg/registry/core/adapters" "github.com/networkservicemesh/sdk/pkg/tools/sandbox" + "github.com/networkservicemesh/sdk/pkg/tools/token" "github.com/networkservicemesh/sdk-k8s/pkg/registry/chains/registryk8s" "github.com/networkservicemesh/sdk-k8s/pkg/tools/k8s/client/clientset/versioned/fake" @@ -327,7 +328,7 @@ func TestNSMGR_FloatingInterdomainUseCase(t *testing.T) { require.NoError(t, err) } -func supplyK8sRegistry(ctx context.Context, expireDuration time.Duration, proxyRegistryURL *url.URL, options ...grpc.DialOption) registryserver.Registry { +func supplyK8sRegistry(ctx context.Context, tokenGenerator token.GeneratorFunc, expireDuration time.Duration, proxyRegistryURL *url.URL, options ...grpc.DialOption) registryserver.Registry { return registryk8s.NewServer(®istryk8s.Config{ ChainCtx: ctx, Namespace: "default", From 9016e92e7615933a5c27f6c916a15d9af10f7880 Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik Date: Tue, 6 Dec 2022 19:17:18 +1100 Subject: [PATCH 2/4] fix linter Signed-off-by: Nikita Skrynnik --- pkg/registry/chains/registryk8s/registry-k8s_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/registry/chains/registryk8s/registry-k8s_test.go b/pkg/registry/chains/registryk8s/registry-k8s_test.go index 82b3832..1bb14a9 100644 --- a/pkg/registry/chains/registryk8s/registry-k8s_test.go +++ b/pkg/registry/chains/registryk8s/registry-k8s_test.go @@ -335,5 +335,5 @@ func supplyK8sRegistry(ctx context.Context, tokenGenerator token.GeneratorFunc, ClientSet: fake.NewSimpleClientset(), ExpirePeriod: expireDuration, ProxyRegistryURL: proxyRegistryURL, - }, registryk8s.WithDialOptions(options...)) + }, tokenGenerator, registryk8s.WithDialOptions(options...)) } From d8f2a944d412e272eb803952f1771ad55376a45d Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik Date: Wed, 7 Dec 2022 16:19:13 +1100 Subject: [PATCH 3/4] add client registry authorization to registry-k8s Signed-off-by: Nikita Skrynnik --- .../chains/registryk8s/registry-k8s.go | 32 +++++++++++++++++-- .../chains/registryk8s/registry-k8s_test.go | 2 +- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/pkg/registry/chains/registryk8s/registry-k8s.go b/pkg/registry/chains/registryk8s/registry-k8s.go index ccbb74f..c0c20c6 100644 --- a/pkg/registry/chains/registryk8s/registry-k8s.go +++ b/pkg/registry/chains/registryk8s/registry-k8s.go @@ -59,7 +59,9 @@ type Config struct { type serverOptions struct { authorizeNSRegistryServer registry.NetworkServiceRegistryServer + authorizeNSRegistryClient registry.NetworkServiceRegistryClient authorizeNSERegistryServer registry.NetworkServiceEndpointRegistryServer + authorizeNSERegistryClient registry.NetworkServiceEndpointRegistryClient dialOptions []grpc.DialOption } @@ -73,7 +75,7 @@ func WithDialOptions(dialOptions ...grpc.DialOption) Option { } } -// WithAuthorizeNSRegistryServer sets authorization NetworkServiceRegistry chain element +// WithAuthorizeNSRegistryServer sets server authorization NetworkServiceRegistry chain element func WithAuthorizeNSRegistryServer(authorizeNSRegistryServer registry.NetworkServiceRegistryServer) Option { if authorizeNSRegistryServer == nil { panic("authorizeNSRegistryServer cannot be nil") @@ -83,7 +85,7 @@ func WithAuthorizeNSRegistryServer(authorizeNSRegistryServer registry.NetworkSer } } -// WithAuthorizeNSERegistryServer sets authorization NetworkServiceEndpointRegistry chain element +// WithAuthorizeNSERegistryServer sets server authorization NetworkServiceEndpointRegistry chain element func WithAuthorizeNSERegistryServer(authorizeNSERegistryServer registry.NetworkServiceEndpointRegistryServer) Option { if authorizeNSERegistryServer == nil { panic("authorizeNSERegistryServer cannot be nil") @@ -93,11 +95,33 @@ func WithAuthorizeNSERegistryServer(authorizeNSERegistryServer registry.NetworkS } } +// WithAuthorizeNSRegistryClient sets client authorization NetworkServiceRegistry chain element +func WithAuthorizeNSRegistryClient(authorizeNSRegistryClient registry.NetworkServiceRegistryClient) Option { + if authorizeNSRegistryClient == nil { + panic("authorizeNSRegistryClient cannot be nil") + } + return func(o *serverOptions) { + o.authorizeNSRegistryClient = authorizeNSRegistryClient + } +} + +// WithAuthorizeNSERegistryClient sets client authorization NetworkServiceEndpointRegistry chain element +func WithAuthorizeNSERegistryClient(authorizeNSERegistryClient registry.NetworkServiceEndpointRegistryClient) Option { + if authorizeNSERegistryClient == nil { + panic("authorizeNSERegistryClient cannot be nil") + } + return func(o *serverOptions) { + o.authorizeNSERegistryClient = authorizeNSERegistryClient + } +} + // NewServer creates new registry server based on k8s etcd db storage func NewServer(config *Config, tokenGenerator token.GeneratorFunc, options ...Option) registryserver.Registry { opts := &serverOptions{ authorizeNSRegistryServer: registryauthorize.NewNetworkServiceRegistryServer(registryauthorize.Any()), authorizeNSERegistryServer: registryauthorize.NewNetworkServiceEndpointRegistryServer(registryauthorize.Any()), + authorizeNSRegistryClient: registryauthorize.NewNetworkServiceRegistryClient(registryauthorize.Any()), + authorizeNSERegistryClient: registryauthorize.NewNetworkServiceEndpointRegistryClient(registryauthorize.Any()), } for _, opt := range options { opt(opts) @@ -105,8 +129,8 @@ func NewServer(config *Config, tokenGenerator token.GeneratorFunc, options ...Op nseChain := chain.NewNetworkServiceEndpointRegistryServer( grpcmetadata.NewNetworkServiceEndpointRegistryServer(), - updatepath.NewNetworkServiceEndpointRegistryServer(tokenGenerator), begin.NewNetworkServiceEndpointRegistryServer(), + updatepath.NewNetworkServiceEndpointRegistryServer(tokenGenerator), opts.authorizeNSERegistryServer, switchcase.NewNetworkServiceEndpointRegistryServer(switchcase.NSEServerCase{ Condition: func(c context.Context, nse *registry.NetworkServiceEndpoint) bool { @@ -126,6 +150,7 @@ func NewServer(config *Config, tokenGenerator token.GeneratorFunc, options ...Op begin.NewNetworkServiceEndpointRegistryClient(), clienturl.NewNetworkServiceEndpointRegistryClient(config.ProxyRegistryURL), clientconn.NewNetworkServiceEndpointRegistryClient(), + opts.authorizeNSERegistryClient, grpcmetadata.NewNetworkServiceEndpointRegistryClient(), dial.NewNetworkServiceEndpointRegistryClient(config.ChainCtx, dial.WithDialOptions(opts.dialOptions...), @@ -160,6 +185,7 @@ func NewServer(config *Config, tokenGenerator token.GeneratorFunc, options ...Op clienturl.NewNetworkServiceRegistryClient(config.ProxyRegistryURL), begin.NewNetworkServiceRegistryClient(), clientconn.NewNetworkServiceRegistryClient(), + opts.authorizeNSRegistryClient, grpcmetadata.NewNetworkServiceRegistryClient(), dial.NewNetworkServiceRegistryClient(config.ChainCtx, dial.WithDialOptions(opts.dialOptions...), diff --git a/pkg/registry/chains/registryk8s/registry-k8s_test.go b/pkg/registry/chains/registryk8s/registry-k8s_test.go index 1bb14a9..6860058 100644 --- a/pkg/registry/chains/registryk8s/registry-k8s_test.go +++ b/pkg/registry/chains/registryk8s/registry-k8s_test.go @@ -166,7 +166,7 @@ func TestNSMGR_RemoteUsecase(t *testing.T) { func TestNSMGR_InterdomainUseCase(t *testing.T) { t.Cleanup(func() { goleak.VerifyNone(t, ignoreKLogDaemon) }) - ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5000) defer cancel() var dnsServer = sandbox.NewFakeResolver() From 935fe1905c02f8fa67be5fbab37dc109823d8369 Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik Date: Wed, 7 Dec 2022 16:31:29 +1100 Subject: [PATCH 4/4] revert some changes Signed-off-by: Nikita Skrynnik --- pkg/registry/chains/registryk8s/registry-k8s_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/registry/chains/registryk8s/registry-k8s_test.go b/pkg/registry/chains/registryk8s/registry-k8s_test.go index 6860058..1bb14a9 100644 --- a/pkg/registry/chains/registryk8s/registry-k8s_test.go +++ b/pkg/registry/chains/registryk8s/registry-k8s_test.go @@ -166,7 +166,7 @@ func TestNSMGR_RemoteUsecase(t *testing.T) { func TestNSMGR_InterdomainUseCase(t *testing.T) { t.Cleanup(func() { goleak.VerifyNone(t, ignoreKLogDaemon) }) - ctx, cancel := context.WithTimeout(context.Background(), time.Second*5000) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) defer cancel() var dnsServer = sandbox.NewFakeResolver()