From 565471f17fe8d1e3914df239eec16f73ef20e245 Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik <93182827+NikitaSkrynnik@users.noreply.github.com> Date: Thu, 21 Dec 2023 23:53:18 +1100 Subject: [PATCH] [qfix] Some minor fixes for NSE Unregister scenario (#1568) * [qfix] Pass grpc options to the next chain element in clientConnNSEClient Signed-off-by: Nikita Skrynnik * do not delete nse from localbypass.nseURLs if unregister fails Signed-off-by: Nikita Skrynnik * apply review comments Signed-off-by: Nikita Skrynnik --------- Signed-off-by: Nikita Skrynnik --- pkg/registry/common/clientconn/nse_client.go | 2 +- pkg/registry/common/localbypass/server.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/registry/common/clientconn/nse_client.go b/pkg/registry/common/clientconn/nse_client.go index 569dfa42a..98df904bf 100644 --- a/pkg/registry/common/clientconn/nse_client.go +++ b/pkg/registry/common/clientconn/nse_client.go @@ -40,7 +40,7 @@ func (c *clientConnNSEClient) Register(ctx context.Context, in *registry.Network func (c *clientConnNSEClient) Unregister(ctx context.Context, in *registry.NetworkServiceEndpoint, opts ...grpc.CallOption) (*empty.Empty, error) { ctx = withClientConnMetadata(ctx, &c.Map, in.GetName()) - return next.NetworkServiceEndpointRegistryClient(ctx).Unregister(ctx, in) + return next.NetworkServiceEndpointRegistryClient(ctx).Unregister(ctx, in, opts...) } func (c *clientConnNSEClient) Find(ctx context.Context, in *registry.NetworkServiceEndpointQuery, opts ...grpc.CallOption) (registry.NetworkServiceEndpointRegistry_FindClient, error) { diff --git a/pkg/registry/common/localbypass/server.go b/pkg/registry/common/localbypass/server.go index e24d663ee..4f7e19ba0 100644 --- a/pkg/registry/common/localbypass/server.go +++ b/pkg/registry/common/localbypass/server.go @@ -104,8 +104,9 @@ func (s *localBypassNSEServer) Unregister(ctx context.Context, nse *registry.Net nse.Url = s.nsmgrURL _, err = next.NetworkServiceEndpointRegistryServer(ctx).Unregister(ctx, nse) - - s.nseURLs.Delete(nse.Name) + if err == nil { + s.nseURLs.Delete(nse.Name) + } } return new(empty.Empty), err }