Skip to content

Commit fc344db

Browse files
authored
Merge pull request #572 from Revolyssup/removeOAM
Remove OAM and update adapter library
2 parents 7a50544 + 2b97313 commit fc344db

File tree

6,591 files changed

+1508
-624844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,591 files changed

+1508
-624844
lines changed

build/config.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ import (
1818
var DefaultGenerationMethod string
1919
var DefaultGenerationURL string
2020
var LatestVersion string
21-
var WorkloadPath string
2221
var MeshModelPath string
2322
var AllVersions []string
2423

2524
const Component = "Istio"
2625

27-
var Meshmodelmetadata = make(map[string]interface{})
28-
2926
var MeshModelConfig = adapter.MeshModelConfig{ //Move to build/config.go
3027
Category: "Cloud Native Network",
31-
Metadata: Meshmodelmetadata,
28+
Metadata: map[string]interface{}{},
3229
}
3330

3431
// NewConfig creates the configuration for creating components
@@ -59,9 +56,8 @@ func init() {
5956
}()
6057
byt, _ := io.ReadAll(f)
6158

62-
_ = json.Unmarshal(byt, &Meshmodelmetadata)
59+
_ = json.Unmarshal(byt, &MeshModelConfig.Metadata)
6360
wd, _ := os.Getwd()
64-
WorkloadPath = filepath.Join(wd, "templates", "oam", "workloads")
6561
MeshModelPath = filepath.Join(wd, "templates", "meshmodel", "components")
6662
AllVersions, _ = utils.GetLatestReleaseTagsSorted("istio", "istio")
6763
if len(AllVersions) == 0 {

build/meshmodel_metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"secondaryColor": "#93b0e6",
44
"shape": "circle",
55
"logoURL": "https://github.com/istio/istio/blob/master/logo/istio-bluelogo-whitebackground-unframed.svg",
6-
"svgColor": "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 160 240\"><g id=\"logo\" fill=\"#466BB0\"><rect id=\"background\" width=\"160\" height=\"240\" fill=\"#fff\"/><polygon id=\"hull\" points=\"0 210 160 210 60 240\"/><polygon id=\"mainsail\" points=\"0 200 60 190 60 80\"/><polygon id=\"headsail\" points=\"70 190 160 200 70 0\"/></g></svg>\n",
7-
"svgWhite": "<svg viewBox=\"6.386270046234131 3.7419400215148926 18.227430820465088 25.258059978485107\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6.38627 24.7904L13.2215 23.738V12.1613L6.38627 24.7904Z\" fill=\"white\"/><path d=\"M6.38627 25.8427H24.6137L13.2215 29L6.38627 25.8427Z\" fill=\"white\"/><path d=\"M14.3608 23.7379L24.6137 24.7904L14.3608 3.74194V23.7379Z\" fill=\"white\"/></svg>"
6+
"svgColor": "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"20\" width=\"20\" viewBox=\"0 0 160 240\"><g id=\"logo\" fill=\"#466BB0\"><rect id=\"background\" width=\"160\" height=\"240\" fill=\"#fff\"/><polygon id=\"hull\" points=\"0 210 160 210 60 240\"/><polygon id=\"mainsail\" points=\"0 200 60 190 60 80\"/><polygon id=\"headsail\" points=\"70 190 160 200 70 0\"/></g></svg>\n",
7+
"svgWhite": "<svg height=\"20\" width=\"20\" viewBox=\"6.386270046234131 3.7419400215148926 18.227430820465088 25.258059978485107\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6.38627 24.7904L13.2215 23.738V12.1613L6.38627 24.7904Z\" fill=\"white\"/><path d=\"M6.38627 25.8427H24.6137L13.2215 29L6.38627 25.8427Z\" fill=\"white\"/><path d=\"M14.3608 23.7379L24.6137 24.7904L14.3608 3.74194V23.7379Z\" fill=\"white\"/></svg>"
88
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ replace (
1313

1414
require (
1515
github.com/aspenmesh/istio-vet v0.0.0-20200806222806-9c8e9a962b9f
16-
github.com/layer5io/meshery-adapter-library v0.6.5
16+
github.com/layer5io/meshery-adapter-library v0.6.7
1717
github.com/layer5io/meshkit v0.6.34
1818
github.com/layer5io/service-mesh-performance v0.3.4
1919
gopkg.in/yaml.v2 v2.4.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6Fm
583583
github.com/layer5io/kuttl v0.4.1-0.20200723152044-916f10574334/go.mod h1:UmrVd7x+bNVKrpmKgTtfRiTKHZeNPcMjQproJ0vGwhE=
584584
github.com/layer5io/learn-layer5/smi-conformance v0.0.0-20210317075357-06b4f88b3e34 h1:QaViadDOBCMDUwYx78kfRvHMkzRVnh/GOhm3s2gxoP4=
585585
github.com/layer5io/learn-layer5/smi-conformance v0.0.0-20210317075357-06b4f88b3e34/go.mod h1:BQPLwdJt7v7y0fXIejI4whR9zMyX07Wjt5xrbgEmHLw=
586-
github.com/layer5io/meshery-adapter-library v0.6.5 h1:0MYpWFwLDo3ziiU3RCvIHjAUQf6tWRHVmFIFEID06y0=
587-
github.com/layer5io/meshery-adapter-library v0.6.5/go.mod h1:7vsze4Cd0pzKtbD+BARNa/vt+GYSzmkhKA6unmAD0qc=
586+
github.com/layer5io/meshery-adapter-library v0.6.7 h1:d0NpqTwF4djt0SWKpIGjEl6BTFK9Li32ynYx5BS5A8E=
587+
github.com/layer5io/meshery-adapter-library v0.6.7/go.mod h1:7vsze4Cd0pzKtbD+BARNa/vt+GYSzmkhKA6unmAD0qc=
588588
github.com/layer5io/meshkit v0.6.34 h1:O6reRSDNZOIEvmU1SFYIoocdrYaBWYffvohXGAwcw10=
589589
github.com/layer5io/meshkit v0.6.34/go.mod h1:eNje6+B3/EkAkyvNHgeelwD7pPEf12eTh8iPMgMGfiM=
590590
github.com/layer5io/service-mesh-performance v0.3.2-0.20210122142912-a94e0658b021/go.mod h1:W153amv8aHAeIWxO7b7d7Vibt9RhaEVh4Uh+RG+BumQ=

istio/oam/register.go

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ import (
99
"sync"
1010

1111
"github.com/layer5io/meshery-adapter-library/adapter"
12-
"github.com/layer5io/meshery-istio/internal/config"
1312
"github.com/layer5io/meshkit/models/meshmodel/core/types"
1413
)
1514

1615
var (
17-
basePath, _ = os.Getwd()
18-
19-
//WorkloadPath will be used by both static and component generation
20-
WorkloadPath = filepath.Join(basePath, "templates", "oam", "workloads")
16+
basePath, _ = os.Getwd()
2117
MeshmodelComponents = filepath.Join(basePath, "templates", "meshmodel", "components")
22-
traitPath = filepath.Join(basePath, "templates", "oam", "traits")
2318
)
2419

2520
// AvailableVersions denote the component versions available statically
@@ -55,68 +50,6 @@ func RegisterMeshModelComponents(uuid, runtime, host, port string) error {
5550
Register(uuid)
5651
}
5752

58-
// RegisterWorkloads will register all of the workload definitions
59-
// present in the path oam/workloads
60-
//
61-
// Registration process will send POST request to $runtime/api/oam/workload
62-
func RegisterWorkloads(runtime, host string) error {
63-
oamRDP := []adapter.OAMRegistrantDefinitionPath{}
64-
pathSets, err := load(WorkloadPath)
65-
if err != nil {
66-
return err
67-
}
68-
for _, pathSet := range pathSets {
69-
metadata := map[string]string{
70-
config.OAMAdapterNameMetadataKey: config.IstioOperation,
71-
}
72-
73-
if strings.HasSuffix(pathSet.name, "addon") {
74-
metadata[config.OAMComponentCategoryMetadataKey] = "addon"
75-
}
76-
77-
oamRDP = append(oamRDP, adapter.OAMRegistrantDefinitionPath{
78-
OAMDefintionPath: pathSet.oamDefinitionPath,
79-
OAMRefSchemaPath: pathSet.jsonSchemaPath,
80-
Host: host,
81-
Metadata: metadata,
82-
})
83-
}
84-
85-
return adapter.
86-
NewOAMRegistrant(oamRDP, fmt.Sprintf("%s/api/oam/workload", runtime)).
87-
Register()
88-
}
89-
90-
// RegisterTraits will register all of the trait definitions
91-
// present in the path oam/traits
92-
//
93-
// Registeration process will send POST request to $runtime/api/oam/trait
94-
func RegisterTraits(runtime, host string) error {
95-
oamRDP := []adapter.OAMRegistrantDefinitionPath{}
96-
97-
pathSets, err := load(traitPath)
98-
if err != nil {
99-
return err
100-
}
101-
102-
for _, pathSet := range pathSets {
103-
metadata := map[string]string{
104-
config.OAMAdapterNameMetadataKey: config.IstioOperation,
105-
}
106-
107-
oamRDP = append(oamRDP, adapter.OAMRegistrantDefinitionPath{
108-
OAMDefintionPath: pathSet.oamDefinitionPath,
109-
OAMRefSchemaPath: pathSet.jsonSchemaPath,
110-
Host: host,
111-
Metadata: metadata,
112-
})
113-
}
114-
115-
return adapter.
116-
NewOAMRegistrant(oamRDP, fmt.Sprintf("%s/api/oam/trait", runtime)).
117-
Register()
118-
}
119-
12053
var versionLock sync.Mutex
12154

12255
func loadMeshmodelComponents(basepath string) ([]meshmodelDefinitionPathSet, error) {
@@ -176,7 +109,3 @@ func load(basePath string) ([]schemaDefinitionPathSet, error) {
176109

177110
return res, nil
178111
}
179-
func init() {
180-
//This is done only to find available versions at startup
181-
_, _ = load(WorkloadPath)
182-
}

main.go

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"fmt"
1818
"os"
1919
"path"
20-
"path/filepath"
2120
"strings"
2221
"time"
2322

@@ -152,15 +151,6 @@ func serviceAddress() string {
152151
}
153152

154153
func registerCapabilities(port string, log logger.Handler) {
155-
// Register workloads
156-
log.Info("Registering static workloads with Meshery Server...")
157-
if err := oam.RegisterWorkloads(mesheryServerAddress(), serviceAddress()+":"+port); err != nil {
158-
log.Error(err)
159-
}
160-
// Register traits
161-
if err := oam.RegisterTraits(mesheryServerAddress(), serviceAddress()+":"+port); err != nil {
162-
log.Error(err)
163-
}
164154
err := oam.RegisterMeshModelComponents(instanceID, mesheryServerAddress(), serviceAddress(), port)
165155
if err != nil {
166156
log.Error(err)
@@ -199,11 +189,9 @@ func registerWorkloads(port string, log logger.Handler) {
199189
}
200190

201191
log.Info("Registering latest workload components for version ", version)
202-
203192
err := adapter.CreateComponents(adapter.StaticCompConfig{
204193
URL: url,
205194
Method: gm,
206-
OAMPath: build.WorkloadPath,
207195
MeshModelPath: build.MeshModelPath,
208196
MeshModelConfig: build.MeshModelConfig,
209197
DirName: version,
@@ -214,22 +202,23 @@ func registerWorkloads(port string, log logger.Handler) {
214202
log.Error(err)
215203
return
216204
}
205+
// err := adapter.CreateComponents(adapter.StaticCompConfig{
206+
// URL: url,
207+
// Method: gm,
208+
// MeshModelPath: build.MeshModelPath,
209+
// MeshModelConfig: build.MeshModelConfig,
210+
// DirName: version,
211+
// Config: build.NewConfig(version),
212+
// })
217213

218214
//The below log is checked in the workflows. If you change this log, reflect that change in the workflow where components are generated
219215
log.Info("Component creation completed for version ", version)
220216

221217
//Now we will register in case
222218
log.Info("Registering workloads with Meshery Server for version ", version)
223-
originalPath := oam.WorkloadPath
224-
oam.WorkloadPath = filepath.Join(originalPath, version)
225-
defer resetWorkloadPath(originalPath)
226-
if err := oam.RegisterWorkloads(mesheryServerAddress(), serviceAddress()+":"+port); err != nil {
219+
if err := oam.RegisterMeshModelComponents(instanceID, mesheryServerAddress(), serviceAddress(), port); err != nil {
227220
log.Error(err)
228221
return
229222
}
230223
log.Info("Latest workload components successfully registered for version ", version)
231224
}
232-
233-
func resetWorkloadPath(orig string) {
234-
oam.WorkloadPath = orig
235-
}

templates/meshmodel/components/1.10.0-alpha.0/authorizationpolicy.Istio.meshery.layer5.io_meshmodel.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

templates/meshmodel/components/1.10.0-alpha.0/destinationrule.Istio.meshery.layer5.io_meshmodel.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

templates/meshmodel/components/1.10.0-alpha.0/envoyfilter.Istio.meshery.layer5.io_meshmodel.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)