From 49c839f48994a394ed5004e4e4446b46833c7014 Mon Sep 17 00:00:00 2001 From: Rajamohan Raj Date: Wed, 19 Aug 2020 00:32:30 +0000 Subject: Remove the need for rysnc registration in orchestrator Removed dependency of rsync registration from orchestrator.RSYNC shall have a function NewRsyncInfo to initiate a new rsync independent of the orchestrator and make gRPC calls. Issue-ID: MULTICLOUD-1196 Signed-off-by: Rajamohan Raj Change-Id: I16bbac6a6865cf3c4ee7b763dac72abe2ed1ad0a --- src/rsync/pkg/client/client.go | 2 +- .../pkg/grpc/installappserver/installappserver.go | 3 +- src/rsync/pkg/grpc/register.go | 40 ---------------------- 3 files changed, 2 insertions(+), 43 deletions(-) (limited to 'src/rsync/pkg') diff --git a/src/rsync/pkg/client/client.go b/src/rsync/pkg/client/client.go index 0eaded22..a489b951 100644 --- a/src/rsync/pkg/client/client.go +++ b/src/rsync/pkg/client/client.go @@ -187,4 +187,4 @@ func (c *Client) IsReachable() error { return fmt.Errorf("Kubernetes cluster unreachable") } return nil -} \ No newline at end of file +} diff --git a/src/rsync/pkg/grpc/installappserver/installappserver.go b/src/rsync/pkg/grpc/installappserver/installappserver.go index d70000c0..3a24dab8 100644 --- a/src/rsync/pkg/grpc/installappserver/installappserver.go +++ b/src/rsync/pkg/grpc/installappserver/installappserver.go @@ -16,10 +16,9 @@ package installappserver import ( "context" "encoding/json" - "log" - con "github.com/onap/multicloud-k8s/src/rsync/pkg/context" "github.com/onap/multicloud-k8s/src/rsync/pkg/grpc/installapp" + "log" ) type installappServer struct { diff --git a/src/rsync/pkg/grpc/register.go b/src/rsync/pkg/grpc/register.go index fb462505..60bd50d6 100644 --- a/src/rsync/pkg/grpc/register.go +++ b/src/rsync/pkg/grpc/register.go @@ -19,8 +19,6 @@ import ( "strings" log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils" - controller "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module/controller" - mtypes "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module/types" ) const default_host = "localhost" @@ -58,41 +56,3 @@ func GetServerHostPort() (string, int) { } return host, port } - -func RegisterGrpcServer(host string, port int) error { - // expect name of this rsync program to be in env variable "RSYNC_NAME" - e.g. RSYNC_NAME="rsync" - // This will be the name of the controller that is registered in the orchestrator controller API - // This same name will be used as the key name for intents in the deployment intent group - serviceName := os.Getenv(ENV_RSYNC_NAME) - if serviceName == "" { - serviceName = default_rsync_name - log.Info("Using default name for rsync service name", log.Fields{ - "Name": serviceName, - }) - } - - client := controller.NewControllerClient() - - // Create or update the controller entry - controller := controller.Controller{ - Metadata: mtypes.Metadata{ - Name: serviceName, - }, - Spec: controller.ControllerSpec{ - Host: host, - Port: port, - Type: controller.CONTROLLER_TYPE_ACTION, - Priority: controller.MinControllerPriority, - }, - } - _, err := client.CreateController(controller, true) - if err != nil { - log.Error("Failed to create/update a gRPC controller", log.Fields{ - "Error": err, - "Controller": serviceName, - }) - return err - } - - return nil -} -- cgit 1.2.3-korg