summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-07-16 13:12:03 -0700
committerEric Multanen <eric.w.multanen@intel.com>2020-07-16 16:07:31 -0700
commit97c6ca4bfdfa4f5e367649ebf6a4e2c583e2cb78 (patch)
tree9adeb20034b02282155ada7bca735888d8f082a1 /src/orchestrator/pkg
parentad17b4360890fc2915795515ac265fc66720f4ad (diff)
Move status tracking CR to rsync
Handle creation and deletion of the ResourceBundleState Custom Resource per app/cluster in the rsync microservice instead of adding it to the resources of the composite application in the orchestrator service. Issue-ID: MULTICLOUD-1125 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: Id0c0639ff62e788628e78f972107a7603c27abfb
Diffstat (limited to 'src/orchestrator/pkg')
-rw-r--r--src/orchestrator/pkg/module/instantiation.go6
-rw-r--r--src/orchestrator/pkg/module/instantiation_appcontext_helper.go45
2 files changed, 1 insertions, 50 deletions
diff --git a/src/orchestrator/pkg/module/instantiation.go b/src/orchestrator/pkg/module/instantiation.go
index 1f2e1117..f4e75861 100644
--- a/src/orchestrator/pkg/module/instantiation.go
+++ b/src/orchestrator/pkg/module/instantiation.go
@@ -246,12 +246,6 @@ func (c InstantiationClient) Instantiate(p string, ca string, v string, di strin
return pkgerrors.Wrapf(err, "Unable to get the resources for app :: %s", eachApp.Metadata.Name)
}
- statusResource, err := getStatusResource(ctxval.(string), eachApp.Metadata.Name)
- if err != nil {
- return pkgerrors.Wrapf(err, "Unable to generate the status resource for app :: %s", eachApp.Metadata.Name)
- }
- resources = append(resources, statusResource)
-
specData, err := NewAppIntentClient().GetAllIntentsByApp(eachApp.Metadata.Name, p, ca, v, gIntent)
if err != nil {
return pkgerrors.Wrap(err, "Unable to get the intents for app")
diff --git a/src/orchestrator/pkg/module/instantiation_appcontext_helper.go b/src/orchestrator/pkg/module/instantiation_appcontext_helper.go
index 1cb3f23d..9ace81b6 100644
--- a/src/orchestrator/pkg/module/instantiation_appcontext_helper.go
+++ b/src/orchestrator/pkg/module/instantiation_appcontext_helper.go
@@ -25,16 +25,12 @@ import (
"encoding/json"
"io/ioutil"
- jyaml "github.com/ghodss/yaml"
-
- rb "github.com/onap/multicloud-k8s/src/monitor/pkg/apis/k8splugin/v1alpha1"
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/appcontext"
gpic "github.com/onap/multicloud-k8s/src/orchestrator/pkg/gpic"
log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils"
"github.com/onap/multicloud-k8s/src/orchestrator/utils"
"github.com/onap/multicloud-k8s/src/orchestrator/utils/helm"
pkgerrors "github.com/pkg/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// resource consists of name of reource
@@ -89,7 +85,7 @@ func getResources(st []helm.KubernetesResourceTemplate) ([]resource, error) {
// This might happen when the rendered file just has some comments inside, no real k8s object.
if n == SEPARATOR {
log.Info(":: Ignoring, Unable to render the template ::", log.Fields{"YAML PATH": t.FilePath})
- continue;
+ continue
}
resources = append(resources, resource{name: n, filecontent: string(yamlFile)})
@@ -99,45 +95,6 @@ func getResources(st []helm.KubernetesResourceTemplate) ([]resource, error) {
return resources, nil
}
-// addStatusResource adds a status monitoring resource to the app
-// which consists of name(name+kind) and content
-func getStatusResource(id, app string) (resource, error) {
-
- var statusCr rb.ResourceBundleState
-
- label := id + "-" + app
- name := app + "-" + id
-
- statusCr.TypeMeta.APIVersion = "k8splugin.io/v1alpha1"
- statusCr.TypeMeta.Kind = "ResourceBundleState"
- statusCr.SetName(name)
-
- labels := make(map[string]string)
- labels["emco/deployment-id"] = label
- statusCr.SetLabels(labels)
-
- labelSelector, err := metav1.ParseToLabelSelector("emco/deployment-id = " + label)
- if err != nil {
- log.Info(":: ERROR Parsing Label Selector ::", log.Fields{"Error": err})
- } else {
- statusCr.Spec.Selector = labelSelector
- }
-
- // Marshaling to json then convert to yaml works better than marshaling to yaml
- // The 'apiVersion' attribute was marshaling to 'apiversion'
- // y, _ := yaml.Marshal(&statusCr)
- j, _ := json.Marshal(&statusCr)
- y, _ := jyaml.JSONToYAML(j)
- log.Info(":: RESULTING STATUS CR ::", log.Fields{"StatusCR": y})
-
- statusResource := resource{
- name: name + "+" + "ResourceBundleState",
- filecontent: string(y),
- }
-
- return statusResource, nil
-}
-
func addResourcesToCluster(ct appcontext.AppContext, ch interface{}, resources []resource) error {
var resOrderInstr struct {