Skip to content

Commit

Permalink
Add "service mesh" as category in meshmodel
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Tiwari <ashishjaitiwari15112000@gmail.com>
  • Loading branch information
Revolyssup committed Nov 29, 2022
1 parent 7463c2d commit 40a42bc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions adapter/oam.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,25 @@ func convertOAMtoMeshmodel(def []byte, schema string, isCore bool, meshmodelname
}
var c meshmodel.ComponentDefinition
c.Metadata = make(map[string]interface{})
metaname := strings.Split(manifests.FormatToReadableString(oamdef.ObjectMeta.Name), ".")
var displayname string
if len(metaname) > 0 {
displayname = metaname[0]
}
c.DisplayName = displayname
c.Model.Category = "Service Mesh"
if isCore {
c.APIVersion = oamdef.APIVersion
c.Kind = oamdef.ObjectMeta.Name
c.Model.Version = oamdef.Spec.Metadata["version"]
c.Model.Name = meshmodelname
c.DisplayName = manifests.FormatToReadableString(oamdef.ObjectMeta.Name)
} else {
c.APIVersion = oamdef.Spec.Metadata["k8sAPIVersion"]
c.Kind = oamdef.Spec.Metadata["k8sKind"]
c.Model.Version = oamdef.Spec.Metadata["meshVersion"]
c.Model.Name = oamdef.Spec.Metadata["meshName"]
c.DisplayName = manifests.FormatToReadableString(oamdef.ObjectMeta.Name)
}
c.Model.DisplayName = manifests.FormatToReadableString(c.Model.Name)
c.Format = meshmodel.JSON
c.Schema = schema
byt, err := json.Marshal(c)
Expand Down

0 comments on commit 40a42bc

Please sign in to comment.