Skip to content

Commit

Permalink
Merge branch 'master' into removeUnwantedLogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jougan-0 authored Aug 20, 2024
2 parents 2f78114 + 0f12bc4 commit ff0a65e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,3 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/meshery/schemas => ../schemas
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@ github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/meshery/kompose v1.0.1 h1:lg8B/pkLh6762jeFsQATD8UJZZwXZf/aviC3/dzw78A=
github.com/meshery/kompose v1.0.1/go.mod h1:TWhWTEMbJBUzENf4JTEtBmZRFm/r8n0nS6v4/nSD2vA=
github.com/meshery/schemas v0.7.19 h1:HS+PCZ3ZXbs7cv0JSUNW3kYnbypt3WqZjQ7fMQPy8uo=
github.com/meshery/schemas v0.7.19/go.mod h1:UfiO+zm92yLkaJP0aroNwVnjuozoh793AWDXrKDYmT0=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM=
github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk=
Expand Down
11 changes: 8 additions & 3 deletions models/meshmodel/core/v1beta1/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions models/meshmodel/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ func (rm *RegistryManager) GetEntities(f entity.Filter) ([]entity.Entity, int64,
return f.Get(rm.db)
}

func (rm *RegistryManager) GetEntityById(f entity.Filter) (entity.Entity, error) {
return f.GetById(rm.db)
}

func HostnameToPascalCase(input string) string {
parts := strings.Split(input, ".")
caser := cases.Title(language.English)
Expand Down
3 changes: 0 additions & 3 deletions models/meshmodel/registry/v1beta1/component_filter.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
}

Expand Down
6 changes: 4 additions & 2 deletions models/meshmodel/registry/v1beta1/model_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func countUniqueModels(models []model.ModelDefinition) int {
}
return len(set)
}

func (mf *ModelFilter) GetById(db *database.Handler) (entity.Entity, error) {
m := &model.ModelDefinition{}

Expand Down Expand Up @@ -102,6 +101,9 @@ func (mf *ModelFilter) Get(db *database.Handler) ([]entity.Entity, int64, int, e
var includeComponents, includeRelationships bool

if mf.Greedy {
if mf.Id != "" {
finder = finder.First("model_dbs.id = ?", mf.Id)
}
if mf.Name != "" && mf.DisplayName != "" {
finder = finder.Where("model_dbs.name LIKE ? OR model_dbs.display_name LIKE ?", "%"+mf.Name+"%", "%"+mf.DisplayName+"%")
} else if mf.Name != "" {
Expand Down Expand Up @@ -180,7 +182,7 @@ func (mf *ModelFilter) Get(db *database.Handler) ([]entity.Entity, int64, int, e
if includeComponents {
var components []component.ComponentDefinition
finder := db.Model(&component.ComponentDefinition{}).
Select("component_definition_dbs.id, component_definition_dbs.component, component_definition_dbs.display_name, component_definition_dbs.metadata, component_definition_dbs.schema_version, component_definition_dbs.version").
Select("component_definition_dbs.id, component_definition_dbs.component, component_definition_dbs.display_name, component_definition_dbs.metadata, component_definition_dbs.schema_version, component_definition_dbs.version,component_definition_dbs.styles").
Where("component_definition_dbs.model_id = ?", _modelDB.Id)
if err := finder.Scan(&components).Error; err != nil {
return nil, 0, 0, err
Expand Down
2 changes: 0 additions & 2 deletions utils/kubernetes/apply-manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kubernetes

import (
"context"
"fmt"
"strings"

v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ff0a65e

Please sign in to comment.