Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heal rework #738

Merged
merged 28 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4723dcb
Heal
Feb 25, 2021
f82e046
Fix linter issues
Feb 25, 2021
2f6b4b9
Skip test depends on restoring connection
Feb 25, 2021
8ab29d2
Fix goroutine race
Feb 26, 2021
a5d5778
Remove request updating from monitor
Feb 26, 2021
009fa1e
Merge remote-tracking branch 'origin/master' into pr-heal-squash
Mar 5, 2021
063706d
Localbypass Client
Mar 9, 2021
aced21e
Restore last valid connection by id
Mar 9, 2021
d37f992
Revert "Localbypass Client"
Mar 9, 2021
ade908c
Fix stuck on unregistered endpoint
Mar 9, 2021
a59fd48
Enable NSMgr restored test
Mar 9, 2021
5b59e5f
Merge remote-tracking branch 'origin/master' into pr-heal-squash
Mar 9, 2021
16d1029
Merge remote-tracking branch 'origin/master' into pr-heal-squash
Mar 9, 2021
752c43d
Fix success request waiting for windows
Mar 9, 2021
c4fa1e2
Fix testing registry clients
Mar 9, 2021
bae43f8
Remove registry client from RegisterEndpoint arguments
Mar 17, 2021
8840056
Use timestamppb.New instead of
Mar 17, 2021
ad98d5b
Fix missing candidates on refresh
Mar 17, 2021
7c18752
Add restored pods testing
Mar 17, 2021
ea728ad
Merge remote-tracking branch 'origin/master' into pr-heal-squash
Mar 17, 2021
a59af4e
Merge remote-tracking branch 'origin/master' into pr-heal-squash
Mar 18, 2021
920c1d8
Revert localbypass fix; Skip NSMgr restored heal
Mar 18, 2021
70891b7
Fix data race
Mar 18, 2021
c724d15
Merge remote-tracking branch 'origin/master' into pr-heal-squash
Mar 21, 2021
6e1807c
Fix refresh after heal request; Add refresh after heal testing
Mar 22, 2021
30dde03
Close error chan on initial monitor done
Mar 22, 2021
e588bb9
Merge remote-tracking branch 'origin/master' into pr-heal-squash
Mar 23, 2021
ed6ea14
Pass register heal client func via context
Mar 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions pkg/networkservice/chains/client/client.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2020-2021 Cisco Systems, Inc.
//
// Copyright (c) 2021 Doc.ai and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -20,9 +22,9 @@ package client
import (
"context"

"github.com/google/uuid"
"google.golang.org/grpc"

"github.com/google/uuid"
"github.com/networkservicemesh/api/pkg/api/networkservice"

"github.com/networkservicemesh/sdk/pkg/networkservice/common/heal"
Expand All @@ -37,18 +39,18 @@ import (

type clientOptions struct {
name string
onHeal *networkservice.NetworkServiceClient
additionalFunctionality []networkservice.NetworkServiceClient
authorizeClient networkservice.NetworkServiceClient
registerClientFunc heal.RegisterClientFunc
}

// Option modifies default client chain values.
type Option func(c *clientOptions)

// WithHeal sets heal for the client.
func WithHeal(onHeal *networkservice.NetworkServiceClient) Option {
// WithRegisterHealClientFunc sets server's register client method
func WithRegisterHealClientFunc(registerClientFunc heal.RegisterClientFunc) Option {
return Option(func(c *clientOptions) {
c.onHeal = onHeal
c.registerClientFunc = registerClientFunc
})
}

Expand Down Expand Up @@ -84,7 +86,6 @@ func NewClient(ctx context.Context, cc grpc.ClientConnInterface, clientOpts ...O
var opts = &clientOptions{
name: "client-" + uuid.New().String(),
authorizeClient: null.NewClient(),
onHeal: &rv,
}
for _, opt := range clientOpts {
opt(opts)
Expand All @@ -94,7 +95,7 @@ func NewClient(ctx context.Context, cc grpc.ClientConnInterface, clientOpts ...O
append([]networkservice.NetworkServiceClient{
updatepath.NewClient(opts.name),
serialize.NewClient(),
heal.NewClient(ctx, networkservice.NewMonitorConnectionClient(cc), opts.onHeal),
heal.NewClient(ctx, networkservice.NewMonitorConnectionClient(cc), opts.registerClientFunc),
refresh.NewClient(ctx),
metadata.NewClient(),
}, opts.additionalFunctionality...),
Expand Down
6 changes: 5 additions & 1 deletion pkg/networkservice/chains/nsmgr/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/networkservicemesh/sdk/pkg/networkservice/common/discover"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/excludedprefixes"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/filtermechanisms"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/heal"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/interpose"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms/recvfd"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms/sendfd"
Expand Down Expand Up @@ -111,6 +112,8 @@ func NewServer(ctx context.Context, nsmRegistration *registryapi.NetworkServiceE

nsClient := registryadapter.NetworkServiceServerToClient(nsRegistry)

healServer, registerHealClient := heal.NewServer(ctx, addressof.NetworkServiceClient(adapters.NewServerToClient(rv)))

// Construct Endpoint
rv.Endpoint = endpoint.NewServer(ctx, tokenGenerator,
endpoint.WithName(nsmRegistration.Name),
Expand All @@ -122,10 +125,11 @@ func NewServer(ctx context.Context, nsmRegistration *registryapi.NetworkServiceE
recvfd.NewServer(), // Receive any files passed
interpose.NewServer(&interposeRegistryServer),
filtermechanisms.NewServer(&urlsRegistryServer),
healServer,
connect.NewServer(ctx,
client.NewClientFactory(
client.WithName(nsmRegistration.Name),
client.WithHeal(addressof.NetworkServiceClient(adapters.NewServerToClient(rv))),
client.WithRegisterHealClientFunc(registerHealClient),
client.WithAdditionalFunctionality(
recvfd.NewClient(),
sendfd.NewClient(),
Expand Down
Loading