summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg/module
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-04-23 12:46:35 -0700
committerEric Multanen <eric.w.multanen@intel.com>2020-04-30 16:55:52 -0700
commitea7b430a700a12cbde9e78acb3a993ad4257b12c (patch)
tree6345485d6440b3600a191360659df9036f0b5a09 /src/orchestrator/pkg/module
parent4100bfb764c40e2a788d28691b0f891e2ae86b74 (diff)
Add gRPC framework to orchestrator
Adds proto and generated go files for a healtcheck, contextupdate and installapp rpc services. Adds framework for orchestrator as an rpc client to connect to configured controllers. Issue-ID: MULTICLOUD-1019 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: Ie66865789fe2146258c91e168cfb8d5933905814
Diffstat (limited to 'src/orchestrator/pkg/module')
-rw-r--r--src/orchestrator/pkg/module/controller.go31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/orchestrator/pkg/module/controller.go b/src/orchestrator/pkg/module/controller.go
index 976b8988..6827af87 100644
--- a/src/orchestrator/pkg/module/controller.go
+++ b/src/orchestrator/pkg/module/controller.go
@@ -20,7 +20,8 @@ import (
"encoding/json"
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db"
-
+ log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils"
+ rpc "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/rpc"
pkgerrors "github.com/pkg/errors"
)
@@ -66,6 +67,7 @@ type ControllerManager interface {
CreateController(ms Controller, mayExist bool) (Controller, error)
GetController(name string) (Controller, error)
GetControllers() ([]Controller, error)
+ InitControllers()
DeleteController(name string) error
}
@@ -104,6 +106,9 @@ func (mc *ControllerClient) CreateController(m Controller, mayExist bool) (Contr
return Controller{}, pkgerrors.Wrap(err, "Creating DB Entry")
}
+ // send message to create/update the rpc connection
+ rpc.UpdateRpcConn(m.Metadata.Name, m.Spec.Host, m.Spec.Port)
+
return m, nil
}
@@ -152,15 +157,6 @@ func (mc *ControllerClient) GetControllers() ([]Controller, error) {
return []Controller{}, pkgerrors.Wrap(err, "Unmarshaling Value")
}
- // run healthcheck
- /*
- err = mc.HealthCheck(microserv.Name)
- if err != nil {
- log.Warn("HealthCheck Failed", log.Fields{
- "Controller": microserv.Name,
- })
- }
- */
resp = append(resp, microserv)
}
@@ -178,5 +174,20 @@ func (mc *ControllerClient) DeleteController(name string) error {
if err != nil {
return pkgerrors.Wrap(err, "Delete Controller Entry;")
}
+
+ // send message to close rpc connection
+ rpc.RemoveRpcConn(name)
+
return nil
}
+
+// InitControllers initializes connctions for controllers in the DB
+func (mc *ControllerClient) InitControllers() {
+ vals, _ := mc.GetControllers()
+ for _, v := range vals {
+ log.Info("Initializing RPC connection for controller", log.Fields{
+ "Controller": v.Metadata.Name,
+ })
+ rpc.UpdateRpcConn(v.Metadata.Name, v.Spec.Host, v.Spec.Port)
+ }
+}