Skip to content

Commit

Permalink
grpc-proxy: add proxy API version for live upgrade
Browse files Browse the repository at this point in the history
Longhorn-3546

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang authored and innobead committed May 16, 2022
1 parent 40b0ffe commit ae762d0
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 59 deletions.
22 changes: 18 additions & 4 deletions integration/rpc/instance_manager/imrpc_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/client/process_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,16 @@ func (c *ProcessManagerClient) VersionGet() (*meta.VersionOutput, error) {
if err != nil {
return nil, fmt.Errorf("failed to get version: %v", err)
}

return &meta.VersionOutput{
Version: resp.Version,
GitCommit: resp.GitCommit,
BuildDate: resp.BuildDate,

InstanceManagerAPIVersion: int(resp.InstanceManagerAPIVersion),
InstanceManagerAPIMinVersion: int(resp.InstanceManagerAPIMinVersion),

InstanceManagerProxyAPIVersion: int(resp.InstanceManagerProxyAPIVersion),
InstanceManagerProxyAPIMinVersion: int(resp.InstanceManagerProxyAPIMinVersion),
}, nil
}
4 changes: 4 additions & 0 deletions pkg/client/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"google.golang.org/grpc"

rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/longhorn-instance-manager/pkg/meta"
"github.com/longhorn/longhorn-instance-manager/pkg/util"

emeta "github.com/longhorn/longhorn-engine/pkg/meta"
Expand Down Expand Up @@ -39,6 +40,8 @@ func (c *ProxyClient) Close() error {
type ProxyClient struct {
ServiceURL string
ServiceContext

Version int
}

func NewProxyClient(ctx context.Context, ctxCancel context.CancelFunc, address string, port int) (*ProxyClient, error) {
Expand All @@ -65,6 +68,7 @@ func NewProxyClient(ctx context.Context, ctxCancel context.CancelFunc, address s
return &ProxyClient{
ServiceURL: serviceURL,
ServiceContext: serviceCtx,
Version: meta.InstanceManagerProxyAPIVersion,
}, nil
}

Expand Down
124 changes: 71 additions & 53 deletions pkg/imrpc/imrpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/imrpc/imrpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,7 @@ message VersionResponse {

int64 instanceManagerAPIVersion = 4;
int64 instanceManagerAPIMinVersion = 5;

int64 instanceManagerProxyAPIVersion = 6;
int64 instanceManagerProxyAPIMinVersion = 7;
}
Loading

0 comments on commit ae762d0

Please sign in to comment.