aboutsummaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg/module/instantiation.go
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-06-23 12:23:30 -0700
committerRitu Sood <Ritu.Sood@intel.com>2020-06-26 19:49:03 +0000
commitd972a4453774410868ba48494a80e84232704fe2 (patch)
tree68897029126c548498b34568302b7317e7ea38bd /src/orchestrator/pkg/module/instantiation.go
parent8b5fefd9d4e54c3dab7f626e084359800c155b92 (diff)
Add instruction and rsync call to instantiate
This patch adds app and resource 'order' and 'dependency' instructions to the appcontext, as these are currently expected by rsync. Adds the rsync client and call to rsync to instantiate the appcontext. Issue-ID: MULTICLOUD-1064 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: Iae0da9de4a0ae82bd3ab7ccc72da4abf8b7f2295
Diffstat (limited to 'src/orchestrator/pkg/module/instantiation.go')
-rw-r--r--src/orchestrator/pkg/module/instantiation.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/orchestrator/pkg/module/instantiation.go b/src/orchestrator/pkg/module/instantiation.go
index 76be2a2d..043b80f2 100644
--- a/src/orchestrator/pkg/module/instantiation.go
+++ b/src/orchestrator/pkg/module/instantiation.go
@@ -18,7 +18,9 @@ package module
import (
"encoding/base64"
+ "encoding/json"
"fmt"
+
gpic "github.com/onap/multicloud-k8s/src/orchestrator/pkg/gpic"
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db"
log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils"
@@ -200,11 +202,20 @@ func (c InstantiationClient) Instantiate(p string, ca string, v string, di strin
ctxval := cca.ctxval
compositeHandle := cca.compositeAppHandle
- var appOrder []string
+ var appOrderInstr struct {
+ Apporder []string `json:"apporder"`
+ }
+
+ var appDepInstr struct {
+ Appdep map[string]string `json:"appdependency"`
+ }
+ appdep := make(map[string]string)
// Add composite app using appContext
for _, eachApp := range allApps {
- appOrder = append(appOrder, eachApp.Metadata.Name)
+ appOrderInstr.Apporder = append(appOrderInstr.Apporder, eachApp.Metadata.Name)
+ appdep[eachApp.Metadata.Name] = "go"
+
sortedTemplates, err := GetSortedTemplateForApp(eachApp.Metadata.Name, p, ca, v, rName, cp, overrideValues)
if err != nil {
@@ -250,7 +261,11 @@ func (c InstantiationClient) Instantiate(p string, ca string, v string, di strin
}
}
- context.AddInstruction(compositeHandle, "app", "order", appOrder)
+ jappOrderInstr, _ := json.Marshal(appOrderInstr)
+ appDepInstr.Appdep = appdep
+ jappDepInstr, _ := json.Marshal(appDepInstr)
+ context.AddInstruction(compositeHandle, "app", "order", string(jappOrderInstr))
+ context.AddInstruction(compositeHandle, "app", "dependency", string(jappDepInstr))
//END: storing into etcd
// BEGIN:: save the context in the orchestrator db record
@@ -300,6 +315,10 @@ func (c InstantiationClient) Instantiate(p string, ca string, v string, di strin
// END: Scheduler code
// BEGIN : Rsync code
+ err = callRsync(ctxval)
+ if err != nil {
+ return err
+ }
// END : Rsyc code
log.Info(":: Done with instantiation... ::", log.Fields{"CompositeAppName": ca})