From 96522532c5f76dde1e97b7f957c3591588df9bd5 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Tue, 20 Aug 2024 17:42:40 +0530 Subject: [PATCH 1/2] use source_uri from model metadata Signed-off-by: MUzairS15 --- models/meshmodel/core/v1beta1/host.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/models/meshmodel/core/v1beta1/host.go b/models/meshmodel/core/v1beta1/host.go index 0d2cdee2..fe7d1c61 100644 --- a/models/meshmodel/core/v1beta1/host.go +++ b/models/meshmodel/core/v1beta1/host.go @@ -62,8 +62,8 @@ type ArtifactHub struct{} const MesheryAnnotationPrefix = "design.meshery.io" func (ah ArtifactHub) HandleDependents(comp component.ComponentDefinition, kc *kubernetes.Client, isDeploy, performUpgrade bool) (summary string, err error) { - sourceURI, err := utils.Cast[string](comp.Metadata.AdditionalProperties["source_uri"]) // should be part of registrant data(?) - if err != nil { + sourceURI, ok := comp.Model.Metadata.AdditionalProperties["source_uri"] // should be part of registrant data(?) + if !ok { return summary, err } @@ -72,9 +72,14 @@ func (ah ArtifactHub) HandleDependents(comp component.ComponentDefinition, kc *k act = kubernetes.INSTALL } + _sourceURI, err := utils.Cast[string](sourceURI) + if err != nil { + return summary, err + } + if sourceURI != "" { err = kc.ApplyHelmChart(kubernetes.ApplyHelmChartConfig{ - URL: sourceURI, + URL: _sourceURI, Namespace: comp.Configuration["namespace"].(string), CreateNamespace: true, Action: act, From 2dea93949a08c60b8041a90b8f113b2fe7c0d136 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Tue, 20 Aug 2024 18:05:03 +0530 Subject: [PATCH 2/2] remove debug logs Signed-off-by: MUzairS15 --- models/meshmodel/registry/registry.go | 1 - models/meshmodel/registry/v1beta1/component_filter.go | 3 --- utils/kubernetes/apply-manifest.go | 2 -- 3 files changed, 6 deletions(-) diff --git a/models/meshmodel/registry/registry.go b/models/meshmodel/registry/registry.go index cc9d1c1b..ad1b03cc 100644 --- a/models/meshmodel/registry/registry.go +++ b/models/meshmodel/registry/registry.go @@ -177,7 +177,6 @@ func (rm *RegistryManager) GetRegistrants(f *models.HostFilter) ([]models.MeshMo var response []models.MeshModelHostsWithEntitySummary - fmt.Println("result--------------------------", result) for _, r := range result { res := models.MeshModelHostsWithEntitySummary{ Connection: r.Connection, diff --git a/models/meshmodel/registry/v1beta1/component_filter.go b/models/meshmodel/registry/v1beta1/component_filter.go index 3265abfc..76a6fb57 100644 --- a/models/meshmodel/registry/v1beta1/component_filter.go +++ b/models/meshmodel/registry/v1beta1/component_filter.go @@ -1,8 +1,6 @@ package v1beta1 import ( - "fmt" - "github.com/layer5io/meshkit/database" "github.com/layer5io/meshkit/models/meshmodel/entity" "github.com/layer5io/meshkit/models/meshmodel/registry" @@ -139,7 +137,6 @@ func (componentFilter *ComponentFilter) Get(db *database.Handler) ([]entity.Enti err := finder. Scan(&componentDefinitionsWithModel).Error if err != nil { - fmt.Println("line 123 : =+++++++++++++++", err) return nil, 0, 0, err } diff --git a/utils/kubernetes/apply-manifest.go b/utils/kubernetes/apply-manifest.go index 91a4e8f9..f1d1beac 100644 --- a/utils/kubernetes/apply-manifest.go +++ b/utils/kubernetes/apply-manifest.go @@ -2,7 +2,6 @@ package kubernetes import ( "context" - "fmt" "strings" v1 "k8s.io/api/core/v1" @@ -95,7 +94,6 @@ func (client *Client) ApplyManifest(contents []byte, recvOptions ApplyOptions) e return err } } else { - fmt.Println("Creating object", object) _, err = createObject(helper, options.Namespace, object, options.Update) if err != nil && !kubeerror.IsAlreadyExists(err) { if recvOptions.IgnoreErrors {