diff --git a/api/pkg/apis/v1alpha1/managers/catalogs/catalogs-manager.go b/api/pkg/apis/v1alpha1/managers/catalogs/catalogs-manager.go index 432250734..6fe1a8c4b 100644 --- a/api/pkg/apis/v1alpha1/managers/catalogs/catalogs-manager.go +++ b/api/pkg/apis/v1alpha1/managers/catalogs/catalogs-manager.go @@ -176,7 +176,7 @@ func (m *CatalogsManager) UpsertState(ctx context.Context, name string, state mo } m.Context.Publish("catalog", v1alpha2.Event{ Metadata: map[string]string{ - "objectType": state.Spec.Type, + "objectType": state.Spec.CatalogType, }, Body: v1alpha2.JobData{ Id: state.ObjectMeta.Name, diff --git a/api/pkg/apis/v1alpha1/managers/catalogs/catalogs-manager_test.go b/api/pkg/apis/v1alpha1/managers/catalogs/catalogs-manager_test.go index 7d769f884..195a917e3 100644 --- a/api/pkg/apis/v1alpha1/managers/catalogs/catalogs-manager_test.go +++ b/api/pkg/apis/v1alpha1/managers/catalogs/catalogs-manager_test.go @@ -32,7 +32,7 @@ var catalogState = model.CatalogState{ Name: "name1", }, Spec: &model.CatalogSpec{ - Type: "catalog", + CatalogType: "catalog", Properties: map[string]interface{}{ "property1": "value1", "property2": "value2", @@ -234,7 +234,7 @@ func TestGetChains(t *testing.T) { fmt.Println(v.ObjectMeta.Name) } - val, err := manager.GetChains(context.Background(), catalogState.Spec.Type, catalogState.ObjectMeta.Namespace) + val, err := manager.GetChains(context.Background(), catalogState.Spec.CatalogType, catalogState.ObjectMeta.Namespace) assert.Nil(t, err) assert.Equal(t, 4, len(val["root"])) } @@ -248,7 +248,7 @@ func TestGetTrees(t *testing.T) { err = manager.setProviderDataIfNecessary(context.Background(), catalogState.ObjectMeta.Namespace) assert.Nil(t, err) - val, err := manager.GetTrees(context.Background(), catalogState.Spec.Type, catalogState.ObjectMeta.Namespace) + val, err := manager.GetTrees(context.Background(), catalogState.Spec.CatalogType, catalogState.ObjectMeta.Namespace) assert.Nil(t, err) assert.Equal(t, 7, len(val["root-0"])) } diff --git a/api/pkg/apis/v1alpha1/managers/sync/sync-manager.go b/api/pkg/apis/v1alpha1/managers/sync/sync-manager.go index 30cae6b74..127f87fb2 100644 --- a/api/pkg/apis/v1alpha1/managers/sync/sync-manager.go +++ b/api/pkg/apis/v1alpha1/managers/sync/sync-manager.go @@ -59,7 +59,7 @@ func (s *SyncManager) Poll() []error { for _, catalog := range batch.Catalogs { s.Context.Publish("catalog-sync", v1alpha2.Event{ Metadata: map[string]string{ - "objectType": catalog.Spec.Type, + "objectType": catalog.Spec.CatalogType, "origin": batch.Origin, }, Body: v1alpha2.JobData{ diff --git a/api/pkg/apis/v1alpha1/managers/sync/sync-manager_test.go b/api/pkg/apis/v1alpha1/managers/sync/sync-manager_test.go index 69ff2b17d..bae91c534 100644 --- a/api/pkg/apis/v1alpha1/managers/sync/sync-manager_test.go +++ b/api/pkg/apis/v1alpha1/managers/sync/sync-manager_test.go @@ -115,7 +115,7 @@ func InitiazlizeMockSymphonyAPI(siteId string) *httptest.Server { Name: "catalog1", }, Spec: &model.CatalogSpec{ - Type: "Instance", + CatalogType: "Instance", Properties: map[string]interface{}{ "foo": "bar", }, diff --git a/api/pkg/apis/v1alpha1/model/catalog.go b/api/pkg/apis/v1alpha1/model/catalog.go index e1ec3eb70..d65602b32 100644 --- a/api/pkg/apis/v1alpha1/model/catalog.go +++ b/api/pkg/apis/v1alpha1/model/catalog.go @@ -31,7 +31,7 @@ type ObjectRef struct { Metadata map[string]string `json:"metadata,omitempty"` } type CatalogSpec struct { - Type string `json:"type"` + CatalogType string `json:"catalogType"` Metadata map[string]string `json:"metadata,omitempty"` Properties map[string]interface{} `json:"properties"` ParentName string `json:"parentName,omitempty"` @@ -97,7 +97,7 @@ func (s CatalogState) GetParent() string { } func (s CatalogState) GetType() string { if s.Spec != nil { - return s.Spec.Type + return s.Spec.CatalogType } return "" } @@ -111,7 +111,7 @@ func (s CatalogState) GetProperties() map[string]interface{} { // IEdge interface func (s CatalogState) GetFrom() string { if s.Spec != nil { - if s.Spec.Type == "edge" { + if s.Spec.CatalogType == "edge" { if s.Spec.Metadata != nil { if from, ok := s.Spec.Metadata["from"]; ok { return from @@ -124,7 +124,7 @@ func (s CatalogState) GetFrom() string { func (s CatalogState) GetTo() string { if s.Spec != nil { - if s.Spec.Type == "edge" { + if s.Spec.CatalogType == "edge" { if s.Spec.Metadata != nil { if to, ok := s.Spec.Metadata["to"]; ok { return to diff --git a/api/pkg/apis/v1alpha1/model/catalog_test.go b/api/pkg/apis/v1alpha1/model/catalog_test.go index 097807ed4..89ce7e4ca 100644 --- a/api/pkg/apis/v1alpha1/model/catalog_test.go +++ b/api/pkg/apis/v1alpha1/model/catalog_test.go @@ -50,7 +50,7 @@ func TestCatalogMatch(t *testing.T) { func TestCatalogMatchOneEmpty(t *testing.T) { catalog1 := CatalogSpec{ - Type: "type", + CatalogType: "type", Properties: map[string]interface{}{ "key": "value", }, @@ -132,7 +132,7 @@ func TestGetProperties(t *testing.T) { func TestGetType(t *testing.T) { catalog := CatalogState{ Spec: &CatalogSpec{ - Type: "type", + CatalogType: "type", }, } assert.Equal(t, catalog.GetType(), "type") @@ -144,7 +144,7 @@ func TestGetType(t *testing.T) { func TestGetFrom(t *testing.T) { catalog := CatalogState{ Spec: &CatalogSpec{ - Type: "edge", + CatalogType: "edge", Metadata: map[string]string{ "from": "from", }, @@ -159,7 +159,7 @@ func TestGetFrom(t *testing.T) { func TestGetTo(t *testing.T) { catalog := CatalogState{ Spec: &CatalogSpec{ - Type: "edge", + CatalogType: "edge", Metadata: map[string]string{ "to": "to", }, diff --git a/api/pkg/apis/v1alpha1/model/instance.go b/api/pkg/apis/v1alpha1/model/instance.go index 5c46e1ca3..c7cec3b20 100644 --- a/api/pkg/apis/v1alpha1/model/instance.go +++ b/api/pkg/apis/v1alpha1/model/instance.go @@ -23,18 +23,17 @@ type ( // InstanceSpec defines the spec property of the InstanceState // +kubebuilder:object:generate=true InstanceSpec struct { - DisplayName string `json:"displayName,omitempty"` - Scope string `json:"scope,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` //TODO: Do we still need this? - Metadata map[string]string `json:"metadata,omitempty"` - Solution string `json:"solution"` - Target TargetSelector `json:"target,omitempty"` - Topologies []TopologySpec `json:"topologies,omitempty"` - Pipelines []PipelineSpec `json:"pipelines,omitempty"` - Arguments map[string]map[string]string `json:"arguments,omitempty"` - Generation string `json:"generation,omitempty"` - Version string `json:"version,omitempty"` - RootResource string `json:"rootResource,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Scope string `json:"scope,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` //TODO: Do we still need this? + Metadata map[string]string `json:"metadata,omitempty"` + Solution string `json:"solution"` + Target TargetSelector `json:"target,omitempty"` + Topologies []TopologySpec `json:"topologies,omitempty"` + Pipelines []PipelineSpec `json:"pipelines,omitempty"` + Generation string `json:"generation,omitempty"` + Version string `json:"version,omitempty"` + RootResource string `json:"rootResource,omitempty"` } // TargertRefSpec defines the target the instance will deploy to @@ -157,10 +156,6 @@ func (c InstanceSpec) DeepEquals(other IDeepEquals) (bool, error) { return false, nil } - if !StringStringMapsEqual(c.Arguments, otherC.Arguments, nil) { - return false, nil - } - return true, nil } diff --git a/api/pkg/apis/v1alpha1/model/instance_test.go b/api/pkg/apis/v1alpha1/model/instance_test.go index b41c8f606..d411bdc93 100644 --- a/api/pkg/apis/v1alpha1/model/instance_test.go +++ b/api/pkg/apis/v1alpha1/model/instance_test.go @@ -80,9 +80,6 @@ func TestInstanceDeepEqualsOneEmpty(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -111,9 +108,6 @@ func TestInstanceDeepEqualsNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -136,9 +130,6 @@ func TestInstanceDeepEqualsNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -167,9 +158,6 @@ func TestInstanceDeepEqualsDisplayNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -192,9 +180,6 @@ func TestInstanceDeepEqualsDisplayNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -223,9 +208,6 @@ func TestInstanceDeepEqualsNamespaceNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -248,9 +230,6 @@ func TestInstanceDeepEqualsNamespaceNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -279,9 +258,6 @@ func TestInstanceDeepEqualsTargetNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -304,9 +280,6 @@ func TestInstanceDeepEqualsTargetNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -335,9 +308,6 @@ func TestInstanceDeepEqualsTopologiestNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -360,9 +330,6 @@ func TestInstanceDeepEqualsTopologiestNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -391,9 +358,6 @@ func TestInstanceEqualsPipelineNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, Metadata: map[string]string{ "foo": "bar", }, @@ -416,121 +380,6 @@ func TestInstanceEqualsPipelineNameNotMatch(t *testing.T) { Pipelines: []PipelineSpec{{ Name: "PipelineName1", }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, - Metadata: map[string]string{ - "foo": "bar", - }, - }, - } - res, err := Instance.DeepEquals(other) - assert.Nil(t, err) - assert.False(t, res) -} - -func TestInstanceEqualsArgumentsKeysNotMatch(t *testing.T) { - Instance := InstanceState{ - ObjectMeta: ObjectMeta{ - Namespace: "Default", - Name: "InstanceName", - }, - Spec: &InstanceSpec{ - DisplayName: "InstanceDisplayName", - Solution: "SolutionName", - Target: TargetSelector{ - Name: "TargetName", - }, - Topologies: []TopologySpec{{ - Device: "DeviceName", - }}, - Pipelines: []PipelineSpec{{ - Name: "PipelineName", - }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, - Metadata: map[string]string{ - "foo": "bar", - }, - }, - } - other := InstanceState{ - ObjectMeta: ObjectMeta{ - Namespace: "Default", - Name: "InstanceName", - }, - Spec: &InstanceSpec{ - DisplayName: "InstanceDisplayName", - Solution: "SolutionName", - Target: TargetSelector{ - Name: "TargetName", - }, - Topologies: []TopologySpec{{ - Device: "DeviceName", - }}, - Pipelines: []PipelineSpec{{ - Name: "PipelineName", - }}, - Arguments: map[string]map[string]string{ - "foo1": {"foo": "bar"}, - }, - Metadata: map[string]string{ - "foo": "bar", - }, - }, - } - res, err := Instance.DeepEquals(other) - assert.Nil(t, err) - assert.False(t, res) -} - -func TestInstanceEqualsArgumentsValuesNotMatch(t *testing.T) { - Instance := InstanceState{ - ObjectMeta: ObjectMeta{ - Namespace: "Default", - Name: "InstanceName", - }, - Spec: &InstanceSpec{ - DisplayName: "InstanceDisplayName", - Solution: "SolutionName", - Target: TargetSelector{ - Name: "TargetName", - }, - Topologies: []TopologySpec{{ - Device: "DeviceName", - }}, - Pipelines: []PipelineSpec{{ - Name: "PipelineName", - }}, - Arguments: map[string]map[string]string{ - "foo": {"foo": "bar"}, - }, - Metadata: map[string]string{ - "foo": "bar", - }, - }, - } - other := InstanceState{ - ObjectMeta: ObjectMeta{ - Namespace: "Default", - Name: "InstanceName", - }, - Spec: &InstanceSpec{ - DisplayName: "InstanceDisplayName", - Solution: "SolutionName", - Target: TargetSelector{ - Name: "TargetName", - }, - Topologies: []TopologySpec{{ - Device: "DeviceName", - }}, - Pipelines: []PipelineSpec{{ - Name: "PipelineName", - }}, - Arguments: map[string]map[string]string{ - "foo": {"foo1": "bar1"}, - }, Metadata: map[string]string{ "foo": "bar", }, diff --git a/api/pkg/apis/v1alpha1/model/zz_generated.deepcopy.go b/api/pkg/apis/v1alpha1/model/zz_generated.deepcopy.go index a8ed1dca8..dc1350d7a 100644 --- a/api/pkg/apis/v1alpha1/model/zz_generated.deepcopy.go +++ b/api/pkg/apis/v1alpha1/model/zz_generated.deepcopy.go @@ -154,24 +154,6 @@ func (in *InstanceSpec) DeepCopyInto(out *InstanceSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.Arguments != nil { - in, out := &in.Arguments, &out.Arguments - *out = make(map[string]map[string]string, len(*in)) - for key, val := range *in { - var outVal map[string]string - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - (*out)[key] = outVal - } - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSpec. diff --git a/api/pkg/apis/v1alpha1/providers/stage/materialize/materialize.go b/api/pkg/apis/v1alpha1/providers/stage/materialize/materialize.go index ecfdaf690..60f33f7e6 100644 --- a/api/pkg/apis/v1alpha1/providers/stage/materialize/materialize.go +++ b/api/pkg/apis/v1alpha1/providers/stage/materialize/materialize.go @@ -151,7 +151,7 @@ func (i *MaterializeStageProvider) Process(ctx context.Context, mgrContext conte if s, ok := inputs["__origin"]; ok { name = strings.TrimPrefix(catalog.ObjectMeta.Name, fmt.Sprintf("%s-", s)) } - switch catalog.Spec.Type { + switch catalog.Spec.CatalogType { case "instance": var instanceState model.InstanceState err = json.Unmarshal(objectData, &instanceState) diff --git a/api/pkg/apis/v1alpha1/providers/stage/materialize/materialize_test.go b/api/pkg/apis/v1alpha1/providers/stage/materialize/materialize_test.go index 8cbd4ed32..39c596f1d 100644 --- a/api/pkg/apis/v1alpha1/providers/stage/materialize/materialize_test.go +++ b/api/pkg/apis/v1alpha1/providers/stage/materialize/materialize_test.go @@ -170,7 +170,7 @@ func InitializeMockSymphonyAPI(t *testing.T, expectNs string) *httptest.Server { Name: "hq-target1-v1", }, Spec: &model.CatalogSpec{ - Type: "target", + CatalogType: "target", Properties: map[string]interface{}{ "spec": &model.TargetSpec{ DisplayName: "target1", @@ -186,7 +186,7 @@ func InitializeMockSymphonyAPI(t *testing.T, expectNs string) *httptest.Server { Name: "hq-instance1-v1", }, Spec: &model.CatalogSpec{ - Type: "instance", + CatalogType: "instance", Properties: map[string]interface{}{ "spec": model.InstanceSpec{}, "metadata": &model.ObjectMeta{ @@ -201,7 +201,7 @@ func InitializeMockSymphonyAPI(t *testing.T, expectNs string) *httptest.Server { Name: "hq-solution1-v1", }, Spec: &model.CatalogSpec{ - Type: "solution", + CatalogType: "solution", Properties: map[string]interface{}{ "spec": model.SolutionSpec{ DisplayName: "solution1", @@ -217,11 +217,11 @@ func InitializeMockSymphonyAPI(t *testing.T, expectNs string) *httptest.Server { Name: "hq-catalog1-v1", }, Spec: &model.CatalogSpec{ - Type: "catalog", + CatalogType: "catalog", Properties: map[string]interface{}{ "spec": model.CatalogSpec{ - Type: "config", - Properties: map[string]interface{}{}, + CatalogType: "config", + Properties: map[string]interface{}{}, }, "metadata": &model.ObjectMeta{ Namespace: "objNS", diff --git a/api/pkg/apis/v1alpha1/providers/stage/patch/patch_test.go b/api/pkg/apis/v1alpha1/providers/stage/patch/patch_test.go index 522e99da5..89ff0054f 100644 --- a/api/pkg/apis/v1alpha1/providers/stage/patch/patch_test.go +++ b/api/pkg/apis/v1alpha1/providers/stage/patch/patch_test.go @@ -301,7 +301,7 @@ func InitializeMockSymphonyAPI() *httptest.Server { Name: "catalog1", }, Spec: &model.CatalogSpec{ - Type: "config", + CatalogType: "config", Properties: map[string]interface{}{ "testkey": "0", "testdict": []string{"1"}, diff --git a/api/pkg/apis/v1alpha1/providers/target/staging/staging.go b/api/pkg/apis/v1alpha1/providers/target/staging/staging.go index f4daba08d..9bc878403 100644 --- a/api/pkg/apis/v1alpha1/providers/target/staging/staging.go +++ b/api/pkg/apis/v1alpha1/providers/target/staging/staging.go @@ -181,7 +181,7 @@ func (i *StagingTargetProvider) Apply(ctx context.Context, deployment model.Depl if catalog.Spec == nil { catalog.ObjectMeta.Name = deployment.Instance.ObjectMeta.Name + "-" + i.Config.TargetName catalog.Spec = &model.CatalogSpec{ - Type: "staged", + CatalogType: "staged", } } if catalog.Spec.Properties == nil { diff --git a/api/pkg/apis/v1alpha1/utils/parser.go b/api/pkg/apis/v1alpha1/utils/parser.go index 29dd8296d..9fcda93a2 100644 --- a/api/pkg/apis/v1alpha1/utils/parser.go +++ b/api/pkg/apis/v1alpha1/utils/parser.go @@ -414,13 +414,6 @@ func readPropertyInterface(properties map[string]interface{}, key string) (inter return "", fmt.Errorf("property %s is not found", key) } func readArgument(deployment model.DeploymentSpec, component string, key string) (string, error) { - - arguments := deployment.Instance.Spec.Arguments - if ca, ok := arguments[component]; ok { - if a, ok := ca[key]; ok { - return a, nil - } - } components := deployment.Solution.Spec.Components for _, c := range components { if c.Name == component { diff --git a/api/pkg/apis/v1alpha1/utils/parser_test.go b/api/pkg/apis/v1alpha1/utils/parser_test.go index 65432f64c..6854da4ac 100644 --- a/api/pkg/apis/v1alpha1/utils/parser_test.go +++ b/api/pkg/apis/v1alpha1/utils/parser_test.go @@ -1652,11 +1652,6 @@ func TestEvaulateParamArgumentOverride(t *testing.T) { Instance: model.InstanceState{ Spec: &model.InstanceSpec{ Solution: "fake-solution", - Arguments: map[string]map[string]string{ - "component-1": { - "a": "new-value", - }, - }, }, }, SolutionName: "fake-solution", @@ -1677,7 +1672,7 @@ func TestEvaulateParamArgumentOverride(t *testing.T) { Component: "component-1", }) assert.Nil(t, err) - assert.Equal(t, "new-value", val) + assert.Equal(t, "b", val) } func TestEvaulateParamWrongComponentName(t *testing.T) { parser := NewParser("${{$param(a)}}") @@ -1686,11 +1681,6 @@ func TestEvaulateParamWrongComponentName(t *testing.T) { Instance: model.InstanceState{ Spec: &model.InstanceSpec{ Solution: "fake-solution", - Arguments: map[string]map[string]string{ - "component-1": { - "a": "new-value", - }, - }, }, }, SolutionName: "fake-solution", @@ -1719,11 +1709,6 @@ func TestEvaulateParamMissing(t *testing.T) { Instance: model.InstanceState{ Spec: &model.InstanceSpec{ Solution: "fake-solution", - Arguments: map[string]map[string]string{ - "component-1": { - "a": "new-value", - }, - }, }, }, SolutionName: "fake-solution", @@ -1752,11 +1737,6 @@ func TestEvaulateParamExpressionArgumentOverride(t *testing.T) { Instance: model.InstanceState{ Spec: &model.InstanceSpec{ Solution: "fake-solution", - Arguments: map[string]map[string]string{ - "component-1": { - "a": "new-value", - }, - }, }, }, SolutionName: "fake-solution", @@ -1777,7 +1757,7 @@ func TestEvaulateParamExpressionArgumentOverride(t *testing.T) { Component: "component-1", }) assert.Nil(t, err) - assert.Equal(t, "new-valued", val) + assert.Equal(t, "bd", val) } func TestEvaluateDeployment(t *testing.T) { context := utils.EvaluationContext{ @@ -1785,11 +1765,6 @@ func TestEvaluateDeployment(t *testing.T) { Instance: model.InstanceState{ Spec: &model.InstanceSpec{ Solution: "fake-solution", - Arguments: map[string]map[string]string{ - "component-1": { - "a": "new-value", - }, - }, }, }, SolutionName: "fake-solution", @@ -1815,8 +1790,8 @@ func TestEvaluateDeployment(t *testing.T) { } deployment, err := EvaluateDeployment(context) assert.Nil(t, err) - assert.Equal(t, "new-value", deployment.Solution.Spec.Components[0].Properties["foo"]) - assert.Equal(t, "d new-value", deployment.Solution.Spec.Components[0].Properties["bar"]) + assert.Equal(t, "b", deployment.Solution.Spec.Components[0].Properties["foo"]) + assert.Equal(t, "d b", deployment.Solution.Spec.Components[0].Properties["bar"]) } func TestEvaluateDeploymentMetadata(t *testing.T) { @@ -1825,11 +1800,6 @@ func TestEvaluateDeploymentMetadata(t *testing.T) { Instance: model.InstanceState{ Spec: &model.InstanceSpec{ Solution: "fake-solution", - Arguments: map[string]map[string]string{ - "component-1": { - "a": "new-value", - }, - }, }, }, SolutionName: "fake-solution", @@ -1859,10 +1829,10 @@ func TestEvaluateDeploymentMetadata(t *testing.T) { } deployment, err := EvaluateDeployment(context) assert.Nil(t, err) - assert.Equal(t, "new-value", deployment.Solution.Spec.Components[0].Properties["foo"]) - assert.Equal(t, "d new-value", deployment.Solution.Spec.Components[0].Properties["bar"]) - assert.Equal(t, "new-value", deployment.Solution.Spec.Components[0].Metadata["foo"]) - assert.Equal(t, "d new-value", deployment.Solution.Spec.Components[0].Metadata["bar"]) + assert.Equal(t, "b", deployment.Solution.Spec.Components[0].Properties["foo"]) + assert.Equal(t, "d b", deployment.Solution.Spec.Components[0].Properties["bar"]) + assert.Equal(t, "b", deployment.Solution.Spec.Components[0].Metadata["foo"]) + assert.Equal(t, "d b", deployment.Solution.Spec.Components[0].Metadata["bar"]) } func TestEvaluateDeploymentConfig(t *testing.T) { configProvider := &mock.MockConfigProvider{} @@ -1875,11 +1845,6 @@ func TestEvaluateDeploymentConfig(t *testing.T) { Instance: model.InstanceState{ Spec: &model.InstanceSpec{ Solution: "fake-solution", - Arguments: map[string]map[string]string{ - "component-1": { - "a": "new-value", - }, - }, }, }, SolutionName: "fake-solution", diff --git a/api/pkg/apis/v1alpha1/vendors/catalogs-vendor_test.go b/api/pkg/apis/v1alpha1/vendors/catalogs-vendor_test.go index b42114cf4..3568197d1 100644 --- a/api/pkg/apis/v1alpha1/vendors/catalogs-vendor_test.go +++ b/api/pkg/apis/v1alpha1/vendors/catalogs-vendor_test.go @@ -28,7 +28,7 @@ var catalogState = model.CatalogState{ Name: "name1-v1", }, Spec: &model.CatalogSpec{ - Type: "catalog", + CatalogType: "catalog", Properties: map[string]interface{}{ "property1": "value1", "property2": "value2", @@ -173,7 +173,7 @@ func TestCatalogOnCheck(t *testing.T) { var catalogState = model.CatalogState{ Spec: &model.CatalogSpec{ - Type: "catalog", + CatalogType: "catalog", Properties: map[string]interface{}{ "property1": "value1", "property2": "value2", @@ -419,7 +419,7 @@ func TestCatalogOnCatalogsGraphGetChains(t *testing.T) { }, } - catalogState.Spec.Type = "config" + catalogState.Spec.CatalogType = "config" err := CreateSimpleChain("root", 4, *vendor.CatalogsManager, catalogState) assert.Nil(t, err) @@ -441,7 +441,7 @@ func TestCatalogOnCatalogsGraphGetTrees(t *testing.T) { }, } - catalogState.Spec.Type = "asset" + catalogState.Spec.CatalogType = "asset" err := CreateSimpleBinaryTree("root", 3, *vendor.CatalogsManager, catalogState) assert.Nil(t, err) @@ -487,7 +487,7 @@ func TestCatalogSubscribe(t *testing.T) { origin := "parent" vendor.Context.Publish("catalog-sync", v1alpha2.Event{ Metadata: map[string]string{ - "objectType": catalogState.Spec.Type, + "objectType": catalogState.Spec.CatalogType, "origin": origin, }, Body: v1alpha2.JobData{ diff --git a/api/pkg/apis/v1alpha1/vendors/federation-vendor.go b/api/pkg/apis/v1alpha1/vendors/federation-vendor.go index c893e0453..726b52dde 100644 --- a/api/pkg/apis/v1alpha1/vendors/federation-vendor.go +++ b/api/pkg/apis/v1alpha1/vendors/federation-vendor.go @@ -434,7 +434,7 @@ func (f *FederationVendor) onK8sHook(request v1alpha2.COARequest) v1alpha2.COARe } err = f.Vendor.Context.Publish("catalog", v1alpha2.Event{ Metadata: map[string]string{ - "objectType": catalog.Spec.Type, + "objectType": catalog.Spec.CatalogType, }, Body: v1alpha2.JobData{ Id: catalog.ObjectMeta.Name, diff --git a/api/pkg/apis/v1alpha1/vendors/federation-vendor_test.go b/api/pkg/apis/v1alpha1/vendors/federation-vendor_test.go index 0bad17500..3a4ad39b4 100644 --- a/api/pkg/apis/v1alpha1/vendors/federation-vendor_test.go +++ b/api/pkg/apis/v1alpha1/vendors/federation-vendor_test.go @@ -375,7 +375,7 @@ func TestFederationOnSyncGet(t *testing.T) { Name: "catalog1", }, Spec: &model.CatalogSpec{ - Type: "catalog", + CatalogType: "catalog", Properties: map[string]interface{}{ "property1": "value1", "property2": "value2", @@ -470,7 +470,7 @@ func TestFederationOnK8SHook(t *testing.T) { Name: "catalog1", }, Spec: &model.CatalogSpec{ - Type: "catalog", + CatalogType: "catalog", Properties: map[string]interface{}{ "property1": "value1", "property2": "value2", diff --git a/api/pkg/apis/v1alpha1/vendors/visualization-vendor.go b/api/pkg/apis/v1alpha1/vendors/visualization-vendor.go index b3624b652..598632f8c 100644 --- a/api/pkg/apis/v1alpha1/vendors/visualization-vendor.go +++ b/api/pkg/apis/v1alpha1/vendors/visualization-vendor.go @@ -199,7 +199,7 @@ func mergeCatalogs(existingCatalog, newCatalog model.CatalogState) (model.Catalo func convertVisualizationPacketToCatalog(site string, packet model.Packet) (model.CatalogState, error) { catalog := model.CatalogState{ Spec: &model.CatalogSpec{ - Type: "topology", + CatalogType: "topology", Properties: map[string]interface{}{ packet.From: map[string]model.Packet{ packet.To: packet, diff --git a/api/pkg/apis/v1alpha1/vendors/visualization-vendor_test.go b/api/pkg/apis/v1alpha1/vendors/visualization-vendor_test.go index 76984ee59..ce96a8a65 100644 --- a/api/pkg/apis/v1alpha1/vendors/visualization-vendor_test.go +++ b/api/pkg/apis/v1alpha1/vendors/visualization-vendor_test.go @@ -112,7 +112,7 @@ func TestConvertVisualizationPacketToCatalog(t *testing.T) { DataType: "bytes", }) assert.Nil(t, err) - assert.Equal(t, "topology", catalog.Spec.Type) + assert.Equal(t, "topology", catalog.Spec.CatalogType) v, ok := catalog.Spec.Properties["from-1"].(map[string]model.Packet) assert.True(t, ok) @@ -130,7 +130,7 @@ func TestConvertVisualizationPacketToCatalogNoData(t *testing.T) { To: "to-1", }) assert.Nil(t, err) - assert.Equal(t, "topology", catalog.Spec.Type) + assert.Equal(t, "topology", catalog.Spec.CatalogType) v, ok := catalog.Spec.Properties["from-1"].(map[string]model.Packet) assert.True(t, ok) @@ -148,7 +148,7 @@ func TestMergeCatalogsSameKey(t *testing.T) { DataType: "bytes", }) assert.Nil(t, err) - assert.Equal(t, "topology", catalog1.Spec.Type) + assert.Equal(t, "topology", catalog1.Spec.CatalogType) catalog2, err := convertVisualizationPacketToCatalog("fake-site", model.Packet{ Solution: "solution-1", Target: "target-1", @@ -159,7 +159,7 @@ func TestMergeCatalogsSameKey(t *testing.T) { DataType: "bytes", }) assert.Nil(t, err) - assert.Equal(t, "topology", catalog2.Spec.Type) + assert.Equal(t, "topology", catalog2.Spec.CatalogType) mergedCatalog, err := mergeCatalogs(catalog1, catalog2) assert.Nil(t, err) @@ -186,7 +186,7 @@ func TestMergeCatalogsDifferentKey(t *testing.T) { DataType: "bytes", }) assert.Nil(t, err) - assert.Equal(t, "topology", catalog1.Spec.Type) + assert.Equal(t, "topology", catalog1.Spec.CatalogType) catalog2, err := convertVisualizationPacketToCatalog("fake-site", model.Packet{ Solution: "solution-1", Target: "target-1", @@ -197,7 +197,7 @@ func TestMergeCatalogsDifferentKey(t *testing.T) { DataType: "bytes", }) assert.Nil(t, err) - assert.Equal(t, "topology", catalog2.Spec.Type) + assert.Equal(t, "topology", catalog2.Spec.CatalogType) mergedCatalog, err := mergeCatalogs(catalog1, catalog2) assert.Nil(t, err) diff --git a/docs/samples/approval/logicapp/instance-catalog.yaml b/docs/samples/approval/logicapp/instance-catalog.yaml index d5dd70349..c05584f2b 100644 --- a/docs/samples/approval/logicapp/instance-catalog.yaml +++ b/docs/samples/approval/logicapp/instance-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: gated-prometheus-instance spec: - type: instance + catalogType: instance properties: spec: solution: gated-prometheus-server diff --git a/docs/samples/approval/script/instance-catalog.yaml b/docs/samples/approval/script/instance-catalog.yaml index d5dd70349..c05584f2b 100644 --- a/docs/samples/approval/script/instance-catalog.yaml +++ b/docs/samples/approval/script/instance-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: gated-prometheus-instance spec: - type: instance + catalogType: instance properties: spec: solution: gated-prometheus-server diff --git a/docs/samples/configuration/array-merging/catalogs/region1-tags.yml b/docs/samples/configuration/array-merging/catalogs/region1-tags.yml index db1742bf7..1f83ce237 100644 --- a/docs/samples/configuration/array-merging/catalogs/region1-tags.yml +++ b/docs/samples/configuration/array-merging/catalogs/region1-tags.yml @@ -4,7 +4,7 @@ kind: Catalog metadata: name: region1-tags spec: - type: config + catalogType: config properties: tags: [ "Tag4", @@ -16,7 +16,7 @@ kind: Catalog metadata: name: region1-config spec: - type: config + catalogType: config properties: name: "tags-region1" # This will combine the two arrays of strings into one. The double dollar sign on the second config object is required diff --git a/docs/samples/configuration/array-merging/catalogs/region2-tags.yml b/docs/samples/configuration/array-merging/catalogs/region2-tags.yml index 695f4ef1d..b18c657e6 100644 --- a/docs/samples/configuration/array-merging/catalogs/region2-tags.yml +++ b/docs/samples/configuration/array-merging/catalogs/region2-tags.yml @@ -4,7 +4,7 @@ kind: Catalog metadata: name: region2-tags spec: - type: config + catalogType: config properties: tags: [ "Tag6", @@ -17,7 +17,7 @@ kind: Catalog metadata: name: region2-config spec: - type: config + catalogType: config properties: name: "tags-region2" # This will combine the two arrays of strings into one. The double dollar sign on the second config object is required diff --git a/docs/samples/configuration/array-merging/catalogs/shared-tags.yml b/docs/samples/configuration/array-merging/catalogs/shared-tags.yml index 197ea0942..627cf9fcd 100644 --- a/docs/samples/configuration/array-merging/catalogs/shared-tags.yml +++ b/docs/samples/configuration/array-merging/catalogs/shared-tags.yml @@ -4,7 +4,7 @@ kind: Catalog metadata: name: shared-tags spec: - type: config + catalogType: config properties: tags: [ "Tag1", diff --git a/docs/samples/configuration/conditional-activation/catalogs/line-config.yml b/docs/samples/configuration/conditional-activation/catalogs/line-config.yml index 4e43a6733..f04d202d0 100644 --- a/docs/samples/configuration/conditional-activation/catalogs/line-config.yml +++ b/docs/samples/configuration/conditional-activation/catalogs/line-config.yml @@ -4,7 +4,7 @@ kind: Catalog metadata: name: line-config spec: - type: config + catalogType: config properties: EXTRA-LINE: # Added due to config behavior described in bug: https://github.com/eclipse-symphony/symphony/issues/202 line1: ${{$if($config('line1', 'IS_PREMIUM_LINE'), $config('premium-properties',''), '')}} diff --git a/docs/samples/configuration/conditional-activation/catalogs/line1.yml b/docs/samples/configuration/conditional-activation/catalogs/line1.yml index 7e1f60c7d..e6048a556 100644 --- a/docs/samples/configuration/conditional-activation/catalogs/line1.yml +++ b/docs/samples/configuration/conditional-activation/catalogs/line1.yml @@ -4,6 +4,6 @@ kind: Catalog metadata: name: line1 spec: - type: config + catalogType: config properties: IS_PREMIUM_LINE: true diff --git a/docs/samples/configuration/conditional-activation/catalogs/line2.yml b/docs/samples/configuration/conditional-activation/catalogs/line2.yml index c9d33ac11..52b03eec9 100644 --- a/docs/samples/configuration/conditional-activation/catalogs/line2.yml +++ b/docs/samples/configuration/conditional-activation/catalogs/line2.yml @@ -4,6 +4,6 @@ kind: Catalog metadata: name: line2 spec: - type: config + catalogType: config properties: IS_PREMIUM_LINE: false diff --git a/docs/samples/configuration/conditional-activation/catalogs/premium-properties.yml b/docs/samples/configuration/conditional-activation/catalogs/premium-properties.yml index 266453e7f..a51d72a71 100644 --- a/docs/samples/configuration/conditional-activation/catalogs/premium-properties.yml +++ b/docs/samples/configuration/conditional-activation/catalogs/premium-properties.yml @@ -6,7 +6,7 @@ metadata: labels: version: "1" spec: - type: config + catalogType: config properties: premium_settings: premium_key1: "premium1" diff --git a/docs/samples/configuration/context-based/catalogs/line2.yml b/docs/samples/configuration/context-based/catalogs/line2.yml index 9e3f35ee8..2f9b09a0b 100644 --- a/docs/samples/configuration/context-based/catalogs/line2.yml +++ b/docs/samples/configuration/context-based/catalogs/line2.yml @@ -4,7 +4,7 @@ kind: Catalog metadata: name: line2-config spec: - type: config + catalogType: config properties: line2: name: "Line 2" diff --git a/docs/samples/configuration/reusable-segments/catalogs/segment.yml b/docs/samples/configuration/reusable-segments/catalogs/segment.yml index d8269bd44..841ec5a54 100644 --- a/docs/samples/configuration/reusable-segments/catalogs/segment.yml +++ b/docs/samples/configuration/reusable-segments/catalogs/segment.yml @@ -4,7 +4,7 @@ kind: Catalog metadata: name: segment spec: - type: config + catalogType: config properties: common-key1: "common-value1" common-key2: "common-value2" diff --git a/docs/samples/configuration/reusable-segments/catalogs/top-level.yml b/docs/samples/configuration/reusable-segments/catalogs/top-level.yml index 8f170ab9d..06fbb1fe3 100644 --- a/docs/samples/configuration/reusable-segments/catalogs/top-level.yml +++ b/docs/samples/configuration/reusable-segments/catalogs/top-level.yml @@ -4,7 +4,7 @@ kind: Catalog metadata: name: top-level spec: - type: config + catalogType: config properties: reusable-segment: ${{$config('segment', '')}} key1: "value1" diff --git a/docs/samples/multisite/catalog-catalog.yaml b/docs/samples/multisite/catalog-catalog.yaml index a9354a65c..fd9d192c2 100644 --- a/docs/samples/multisite/catalog-catalog.yaml +++ b/docs/samples/multisite/catalog-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: site-catalog-v1 spec: - type: catalog + catalogType: catalog properties: metadata: name: web-app-config-v1 diff --git a/docs/samples/multisite/instance-catalog.yaml b/docs/samples/multisite/instance-catalog.yaml index c433dfc65..e7ee37b03 100644 --- a/docs/samples/multisite/instance-catalog.yaml +++ b/docs/samples/multisite/instance-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: site-instance-v1 spec: - type: instance + catalogType: instance properties: spec: solution: site-app:v1 diff --git a/docs/samples/multisite/solution-catalog.yaml b/docs/samples/multisite/solution-catalog.yaml index a8dbb6635..bb683683d 100644 --- a/docs/samples/multisite/solution-catalog.yaml +++ b/docs/samples/multisite/solution-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: site-app-v1 spec: - type: solution + catalogType: solution properties: spec: components: diff --git a/docs/samples/multisite/target-catalog.yaml b/docs/samples/multisite/target-catalog.yaml index f2c6b185c..419cb1902 100644 --- a/docs/samples/multisite/target-catalog.yaml +++ b/docs/samples/multisite/target-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: site-k8s-target-v1 spec: - type: target + catalogType: target properties: spec: properties: diff --git a/docs/samples/universe-data/chemical-factory-2/catalogs/assets.yaml b/docs/samples/universe-data/chemical-factory-2/catalogs/assets.yaml index 5b0ecf5aa..4031f992a 100644 --- a/docs/samples/universe-data/chemical-factory-2/catalogs/assets.yaml +++ b/docs/samples/universe-data/chemical-factory-2/catalogs/assets.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: hq spec: - type: asset + catalogType: asset properties: name: HQ address: 1 Microsoft Way @@ -21,7 +21,7 @@ kind: Catalog metadata: name: infrastructure spec: - type: asset + catalogType: asset properties: name: "Infrastructure" parentName: hq @@ -31,7 +31,7 @@ kind: Catalog metadata: name: l3 spec: - type: asset + catalogType: asset properties: name: "Level 3" parentName: infrastructure @@ -41,7 +41,7 @@ kind: Catalog metadata: name: l4 spec: - type: asset + catalogType: asset properties: name: "Level 4" parentName: infrastructure @@ -51,7 +51,7 @@ kind: Catalog metadata: name: use-cases spec: - type: asset + catalogType: asset properties: name: "Use Cases" parentName: hq @@ -61,7 +61,7 @@ kind: Catalog metadata: name: csad spec: - type: asset + catalogType: asset properties: name: "CSAD" parentName: use-cases @@ -71,7 +71,7 @@ kind: Catalog metadata: name: site spec: - type: asset + catalogType: asset properties: name: "Site" parentName: csad @@ -81,7 +81,7 @@ kind: Catalog metadata: name: line-a spec: - type: asset + catalogType: asset properties: name: "Line A" parentName: site @@ -91,7 +91,7 @@ kind: Catalog metadata: name: line-b spec: - type: asset + catalogType: asset properties: name: "Line B" parentName: site \ No newline at end of file diff --git a/docs/samples/universe-data/chemical-factory-2/catalogs/configurations.yaml b/docs/samples/universe-data/chemical-factory-2/catalogs/configurations.yaml index 69c4313f5..61d70fd20 100644 --- a/docs/samples/universe-data/chemical-factory-2/catalogs/configurations.yaml +++ b/docs/samples/universe-data/chemical-factory-2/catalogs/configurations.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: global-config spec: - type: config + catalogType: config name: global-config metadata: asset: hq @@ -17,7 +17,7 @@ kind: Catalog metadata: name: l3-config spec: - type: config + catalogType: config metadata: asset: l3 properties: @@ -30,7 +30,7 @@ kind: Catalog metadata: name: l4-config spec: - type: config + catalogType: config metadata: asset: l4 properties: @@ -43,7 +43,7 @@ kind: Catalog metadata: name: csad-config spec: - type: config + catalogType: config parentName: global-config metadata: asset: use-case @@ -56,7 +56,7 @@ kind: Catalog metadata: name: site-config spec: - type: config + catalogType: config metadata: asset: site parentName: csad-config @@ -70,7 +70,7 @@ kind: Catalog metadata: name: line-a-config spec: - type: config + catalogType: config metadata: asset: line-a parentName: site-config @@ -83,7 +83,7 @@ kind: Catalog metadata: name: line-b-config spec: - type: config + catalogType: config metadata: asset: line-b parentName: site-config diff --git a/docs/samples/universe-data/chemical-factory/configurations-with-schema.yaml b/docs/samples/universe-data/chemical-factory/configurations-with-schema.yaml index 7ff663618..c88d3f2fa 100644 --- a/docs/samples/universe-data/chemical-factory/configurations-with-schema.yaml +++ b/docs/samples/universe-data/chemical-factory/configurations-with-schema.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: sample-config spec: - type: config + catalogType: config metadata: schema: sample-schema properties: diff --git a/docs/samples/universe-data/chemical-factory/configurations.yaml b/docs/samples/universe-data/chemical-factory/configurations.yaml index f1944e07c..76ddc3496 100644 --- a/docs/samples/universe-data/chemical-factory/configurations.yaml +++ b/docs/samples/universe-data/chemical-factory/configurations.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: influx-db-config spec: - type: config + catalogType: config name: influx-db-config properties: host: localhost @@ -19,7 +19,7 @@ kind: Catalog metadata: name: grafana-config spec: - type: config + catalogType: config properties: host: localhost port: 3000 @@ -32,7 +32,7 @@ kind: Catalog metadata: name: e4k-config spec: - type: config + catalogType: config properties: host: localhost port: 3000 @@ -45,7 +45,7 @@ kind: Catalog metadata: name: bluefin-config spec: - type: config + catalogType: config properties: host: localhost port: 3000 @@ -58,7 +58,7 @@ kind: Catalog metadata: name: ai-config spec: - type: config + catalogType: config metadata: asset: hq properties: @@ -71,7 +71,7 @@ kind: Catalog metadata: name: ai-config-site spec: - type: config + catalogType: config parentName: ai-config metadata: asset: hq-doe-site @@ -84,7 +84,7 @@ kind: Catalog metadata: name: ai-config-line spec: - type: config + catalogType: config metadata: asset: line-1 parentName: ai-config-site @@ -96,7 +96,7 @@ kind: Catalog metadata: name: combined spec: - type: config + catalogType: config properties: foo: bar ai: "" @@ -112,7 +112,7 @@ kind: Catalog metadata: name: combined-1 spec: - type: config + catalogType: config properties: foo: .foo loop: .loop @@ -122,7 +122,7 @@ kind: Catalog metadata: name: combined-2 spec: - type: config + catalogType: config properties: foo: bar2 loop: .loop @@ -132,7 +132,7 @@ kind: Catalog metadata: name: external spec: - type: config + catalogType: config properties: foo: far objectRef: diff --git a/docs/samples/universe-data/chemical-factory/manifests.yaml b/docs/samples/universe-data/chemical-factory/manifests.yaml index 9565dbf6c..797617c6b 100644 --- a/docs/samples/universe-data/chemical-factory/manifests.yaml +++ b/docs/samples/universe-data/chemical-factory/manifests.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: site-app-config spec: - type: config + catalogType: config name: site-app-config properties: foo: bar @@ -14,7 +14,7 @@ kind: Catalog metadata: name: line-app-config spec: - type: config + catalogType: config properties: cat: leory dog: snoopy @@ -24,7 +24,7 @@ kind: Catalog metadata: name: site-app spec: - type: solution + catalogType: solution properties: spec: displayName: site-app @@ -48,7 +48,7 @@ kind: Catalog metadata: name: line-app spec: - type: solution + catalogType: solution properties: spec: components: @@ -134,7 +134,7 @@ kind: Catalog metadata: name: smart-fridge spec: - type: solution + catalogType: solution properties: spec: displayName: smart-fridge @@ -160,7 +160,7 @@ kind: Catalog metadata: name: site-instance spec: - type: instance + catalogType: instance properties: spec: solution: site-app diff --git a/docs/samples/universe-data/chemical-factory/schemas.yaml b/docs/samples/universe-data/chemical-factory/schemas.yaml index b86fa70ab..145eefa14 100644 --- a/docs/samples/universe-data/chemical-factory/schemas.yaml +++ b/docs/samples/universe-data/chemical-factory/schemas.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: sample-schema spec: - type: schema + catalogType: schema properties: spec: rules: diff --git a/docs/samples/universe-data/chemical-factory/sites.yaml b/docs/samples/universe-data/chemical-factory/sites.yaml index 9ef9dea57..100868ea7 100644 --- a/docs/samples/universe-data/chemical-factory/sites.yaml +++ b/docs/samples/universe-data/chemical-factory/sites.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: hq spec: - type: asset + catalogType: asset properties: name: HQ address: 1 Microsoft Way @@ -21,7 +21,7 @@ kind: Catalog metadata: name: tokyo spec: - type: asset + catalogType: asset properties: name: "東京" address: "東京都港区港南 2-16-3" @@ -39,7 +39,7 @@ kind: Catalog metadata: name: new-york spec: - type: asset + catalogType: asset properties: name: "New York" address: "11 Times Square" @@ -57,7 +57,7 @@ kind: Catalog metadata: name: munchen spec: - type: asset + catalogType: asset properties: name: "München" address: "Walter-Gropius-Straße 5" @@ -75,7 +75,7 @@ kind: Catalog metadata: name: hq-adr spec: - type: asset + catalogType: asset properties: name: "HQ Azure Device Registry" parentName: hq @@ -95,7 +95,7 @@ kind: Catalog metadata: name: hq-arc-1 spec: - type: asset + catalogType: asset properties: name: "HQ Azure Arc Cluster 1" parentName: hq @@ -115,7 +115,7 @@ kind: Catalog metadata: name: hq-arc-2 spec: - type: asset + catalogType: asset properties: name: "HQ Azure Arc Cluster 2" parentName: hq @@ -135,7 +135,7 @@ kind: Catalog metadata: name: hq-doe-site spec: - type: asset + catalogType: asset properties: name: "HQ DOE Site" parentName: hq @@ -155,7 +155,7 @@ kind: Catalog metadata: name: hq-iot-hub spec: - type: asset + catalogType: asset properties: name: "HQ IoT Hub Tenant" parentName: hq @@ -175,7 +175,7 @@ kind: Catalog metadata: name: area-1 spec: - type: asset + catalogType: asset properties: name: "Area 1" parentName: hq-doe-site @@ -185,7 +185,7 @@ kind: Catalog metadata: name: area-2 spec: - type: asset + catalogType: asset properties: name: "Area 2" parentName: hq-doe-site @@ -195,7 +195,7 @@ kind: Catalog metadata: name: line-1 spec: - type: asset + catalogType: asset properties: name: "Production Line 1" parentName: area-1 @@ -205,7 +205,7 @@ kind: Catalog metadata: name: line-2 spec: - type: asset + catalogType: asset properties: name: "Production Line 2" parentName: area-1 \ No newline at end of file diff --git a/docs/symphony-book/concepts/unified-object-model/catalog.md b/docs/symphony-book/concepts/unified-object-model/catalog.md index 03f038677..2d7f39be4 100644 --- a/docs/symphony-book/concepts/unified-object-model/catalog.md +++ b/docs/symphony-book/concepts/unified-object-model/catalog.md @@ -10,7 +10,7 @@ kind: Catalog metadata: name: hq spec: - type: asset + catalogType: asset properties: name: HQ address: 1 Microsoft Way @@ -34,7 +34,7 @@ kind: Catalog metadata: name: edges spec: - type: edge + catalogType: edge properties: node1: node2 node2: node3 @@ -50,7 +50,7 @@ kind: Catalog metadata: name: app-config spec: - type: config + catalogType: config parentName: global-config metadata: asset: use-case diff --git a/docs/symphony-book/configuration-management/define-configurations.md b/docs/symphony-book/configuration-management/define-configurations.md index b464bd253..ddca720f7 100644 --- a/docs/symphony-book/configuration-management/define-configurations.md +++ b/docs/symphony-book/configuration-management/define-configurations.md @@ -8,7 +8,7 @@ kind: Catalog metadata: name: robot-config spec: - type: config + catalogType: config properties: name: my-robot os_version: "1.34" diff --git a/docs/symphony-book/configuration-management/late-assembly.md b/docs/symphony-book/configuration-management/late-assembly.md index 0e5748010..9523babc2 100644 --- a/docs/symphony-book/configuration-management/late-assembly.md +++ b/docs/symphony-book/configuration-management/late-assembly.md @@ -34,7 +34,7 @@ metadata: name: robot-config spec: siteId: hq - type: config + catalogType: config properties: some-object: "${{$json($config('', ''))}}" some-value: "${{$config('other-config','some-field)}}" diff --git a/docs/symphony-book/get-started/deploy_redis_no_k8s.md b/docs/symphony-book/get-started/deploy_redis_no_k8s.md index 495a6c0de..78d21c51a 100644 --- a/docs/symphony-book/get-started/deploy_redis_no_k8s.md +++ b/docs/symphony-book/get-started/deploy_redis_no_k8s.md @@ -45,20 +45,23 @@ Define your current machine as a [target](../concepts/unified-object-model/targe ```json { - "displayName": "sample-docker-target", - "forceRedeploy": true, - "topologies": [ - { - "bindings": [ - { - "role": "instance", - "provider": "providers.target.docker", - "config": {} - } - ] - } - ] + "spec": { + "displayName": "sample-docker-target", + "forceRedeploy": true, + "topologies": [ + { + "bindings": [ + { + "role": "instance", + "provider": "providers.target.docker", + "config": {} + } + ] + } + ] + } } + ``` ## Define a solution @@ -71,16 +74,18 @@ Define a [solution](../concepts/unified-object-model/solution.md) with a single ```json { - "displayName": "sample-redis", - "components": [ - { - "name": "sample-redis", - "type": "container", - "properties": { - "container.image": "redis:latest" - } + "spec": { + "displayName": "sample-redis", + "components": [ + { + "name": "sample-redis", + "type": "container", + "properties": { + "container.image": "redis:latest" + } } - ] + ] + } } ``` @@ -94,12 +99,14 @@ Define an [instance](../concepts/unified-object-model/instance.md), which trigge ```json { - "displayName": "redis-server", - "name": "default", - "solution": "sample-redis", - "target": { - "name": "sample-docker-target" - } + "spec": { + "displayName": "redis-server", + "name": "default", + "solution": "sample-redis", + "target": { + "name": "sample-docker-target" + } + } } ``` @@ -131,11 +138,13 @@ To delete the container, send a `DELETE` request: ```json { - "displayName": "redis-server", - "solution": "sample-redis", - "target": { - "name": "sample-docker-target" - } + "spec": { + "displayName": "redis-server", + "solution": "sample-redis", + "target": { + "name": "sample-docker-target" + } + } } ``` diff --git a/docs/symphony-book/get-started/quick_start_binary.md b/docs/symphony-book/get-started/quick_start_binary.md index efd9061bd..1bc12d230 100644 --- a/docs/symphony-book/get-started/quick_start_binary.md +++ b/docs/symphony-book/get-started/quick_start_binary.md @@ -21,7 +21,7 @@ go build -o ./symphony-api Launch Symphony with a [configuration file](../hosts/_overview.md): ```bash -./symphony-api -c ./symphony-api-no-k8s.json -l Debug +SYMPHONY_API_URL="http://localhost:8082/v1alpha2/" USE_SERVICE_ACCOUNT_TOKENS="false" ./symphony-api -c ./symphony-api-no-k8s.json -l Debug ``` ## More topics diff --git a/k8s/apis/model/v1/common_types.go b/k8s/apis/model/v1/common_types.go index cb33b2b5d..bfbdccf98 100644 --- a/k8s/apis/model/v1/common_types.go +++ b/k8s/apis/model/v1/common_types.go @@ -87,18 +87,17 @@ type TargetSpec struct { // +kubebuilder:object:generate=true type InstanceSpec struct { - DisplayName string `json:"displayName,omitempty"` - Scope string `json:"scope,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` //TODO: Do we still need this? - Metadata map[string]string `json:"metadata,omitempty"` - Solution string `json:"solution"` - Target model.TargetSelector `json:"target,omitempty"` - Topologies []model.TopologySpec `json:"topologies,omitempty"` - Pipelines []model.PipelineSpec `json:"pipelines,omitempty"` - Arguments map[string]map[string]string `json:"arguments,omitempty"` - Generation string `json:"generation,omitempty"` - Version string `json:"version,omitempty"` - RootResource string `json:"rootResource,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Scope string `json:"scope,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` //TODO: Do we still need this? + Metadata map[string]string `json:"metadata,omitempty"` + Solution string `json:"solution"` + Target model.TargetSelector `json:"target,omitempty"` + Topologies []model.TopologySpec `json:"topologies,omitempty"` + Pipelines []model.PipelineSpec `json:"pipelines,omitempty"` + Generation string `json:"generation,omitempty"` + Version string `json:"version,omitempty"` + RootResource string `json:"rootResource,omitempty"` // Optional ReconcilicationPolicy to specify how target controller should reconcile. // Now only periodic reconciliation is supported. If the interval is 0, it will only reconcile @@ -204,8 +203,8 @@ type CampaignContainerSpec struct { // +kubebuilder:object:generate=true type CatalogSpec struct { - Type string `json:"type"` - Metadata map[string]string `json:"metadata,omitempty"` + CatalogType string `json:"catalogType"` + Metadata map[string]string `json:"metadata,omitempty"` // +kubebuilder:pruning:PreserveUnknownFields // +kubebuilder:validation:Schemaless Properties runtime.RawExtension `json:"properties"` diff --git a/k8s/apis/model/v1/zz_generated.deepcopy.go b/k8s/apis/model/v1/zz_generated.deepcopy.go index 4702e80ac..7e5bea3a2 100644 --- a/k8s/apis/model/v1/zz_generated.deepcopy.go +++ b/k8s/apis/model/v1/zz_generated.deepcopy.go @@ -224,24 +224,6 @@ func (in *InstanceSpec) DeepCopyInto(out *InstanceSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.Arguments != nil { - in, out := &in.Arguments, &out.Arguments - *out = make(map[string]map[string]string, len(*in)) - for key, val := range *in { - var outVal map[string]string - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - (*out)[key] = outVal - } - } if in.ReconciliationPolicy != nil { in, out := &in.ReconciliationPolicy, &out.ReconciliationPolicy *out = new(ReconciliationPolicySpec) diff --git a/k8s/config/oss/crd/bases/federation.symphony_catalogs.yaml b/k8s/config/oss/crd/bases/federation.symphony_catalogs.yaml index 723a47267..1690e1e97 100644 --- a/k8s/config/oss/crd/bases/federation.symphony_catalogs.yaml +++ b/k8s/config/oss/crd/bases/federation.symphony_catalogs.yaml @@ -38,6 +38,8 @@ spec: type: object spec: properties: + catalogType: + type: string generation: type: string metadata: @@ -80,13 +82,11 @@ spec: x-kubernetes-preserve-unknown-fields: true rootResource: type: string - type: - type: string version: type: string required: + - catalogType - properties - - type type: object status: properties: diff --git a/k8s/config/oss/crd/bases/solution.symphony_instances.yaml b/k8s/config/oss/crd/bases/solution.symphony_instances.yaml index 329a46baa..4794f7721 100644 --- a/k8s/config/oss/crd/bases/solution.symphony_instances.yaml +++ b/k8s/config/oss/crd/bases/solution.symphony_instances.yaml @@ -48,12 +48,6 @@ spec: type: object spec: properties: - arguments: - additionalProperties: - additionalProperties: - type: string - type: object - type: object displayName: type: string generation: diff --git a/packages/helm/symphony/templates/symphony-core/symphonyk8s.yaml b/packages/helm/symphony/templates/symphony-core/symphonyk8s.yaml index 6310662c1..ee128f5b4 100644 --- a/packages/helm/symphony/templates/symphony-core/symphonyk8s.yaml +++ b/packages/helm/symphony/templates/symphony-core/symphonyk8s.yaml @@ -342,6 +342,8 @@ spec: type: object spec: properties: + catalogType: + type: string generation: type: string metadata: @@ -384,13 +386,11 @@ spec: x-kubernetes-preserve-unknown-fields: true rootResource: type: string - type: - type: string version: type: string required: + - catalogType - properties - - type type: object status: properties: @@ -612,12 +612,6 @@ spec: type: object spec: properties: - arguments: - additionalProperties: - additionalProperties: - type: string - type: object - type: object displayName: type: string generation: diff --git a/test/integration/scenarios/04.workflow/manifest/catalog-catalog.yaml b/test/integration/scenarios/04.workflow/manifest/catalog-catalog.yaml index a9354a65c..fd9d192c2 100644 --- a/test/integration/scenarios/04.workflow/manifest/catalog-catalog.yaml +++ b/test/integration/scenarios/04.workflow/manifest/catalog-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: site-catalog-v1 spec: - type: catalog + catalogType: catalog properties: metadata: name: web-app-config-v1 diff --git a/test/integration/scenarios/04.workflow/manifest/instance-catalog.yaml b/test/integration/scenarios/04.workflow/manifest/instance-catalog.yaml index 931fcc199..b69bcbd24 100644 --- a/test/integration/scenarios/04.workflow/manifest/instance-catalog.yaml +++ b/test/integration/scenarios/04.workflow/manifest/instance-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: site-instance-v1 spec: - type: instance + catalogType: instance properties: spec: solution: site-app:v1 diff --git a/test/integration/scenarios/04.workflow/manifest/solution-catalog.yaml b/test/integration/scenarios/04.workflow/manifest/solution-catalog.yaml index a8dbb6635..bb683683d 100644 --- a/test/integration/scenarios/04.workflow/manifest/solution-catalog.yaml +++ b/test/integration/scenarios/04.workflow/manifest/solution-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: site-app-v1 spec: - type: solution + catalogType: solution properties: spec: components: diff --git a/test/integration/scenarios/04.workflow/manifest/target-catalog.yaml b/test/integration/scenarios/04.workflow/manifest/target-catalog.yaml index f2c6b185c..419cb1902 100644 --- a/test/integration/scenarios/04.workflow/manifest/target-catalog.yaml +++ b/test/integration/scenarios/04.workflow/manifest/target-catalog.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: site-k8s-target-v1 spec: - type: target + catalogType: target properties: spec: properties: diff --git a/test/integration/scenarios/05.catalog/catalogs/asset.yaml b/test/integration/scenarios/05.catalog/catalogs/asset.yaml index 5457db984..e22a0a3c0 100644 --- a/test/integration/scenarios/05.catalog/catalogs/asset.yaml +++ b/test/integration/scenarios/05.catalog/catalogs/asset.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: asset-v1 spec: - type: asset + catalogType: asset properties: name: "東京" address: "東京都港区港南 2-16-3" diff --git a/test/integration/scenarios/05.catalog/catalogs/config.yaml b/test/integration/scenarios/05.catalog/catalogs/config.yaml index f6c6a27c6..d79ba20cf 100644 --- a/test/integration/scenarios/05.catalog/catalogs/config.yaml +++ b/test/integration/scenarios/05.catalog/catalogs/config.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: config-v1 spec: - type: config + catalogType: config metadata: schema: schema-v1 properties: diff --git a/test/integration/scenarios/05.catalog/catalogs/instance.yaml b/test/integration/scenarios/05.catalog/catalogs/instance.yaml index 8f2aca5da..38a69b92e 100644 --- a/test/integration/scenarios/05.catalog/catalogs/instance.yaml +++ b/test/integration/scenarios/05.catalog/catalogs/instance.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: instance-v1 spec: - type: instance + catalogType: instance properties: spec: solution: app:v1 diff --git a/test/integration/scenarios/05.catalog/catalogs/schema.yaml b/test/integration/scenarios/05.catalog/catalogs/schema.yaml index 810db90c4..0ed34ca49 100644 --- a/test/integration/scenarios/05.catalog/catalogs/schema.yaml +++ b/test/integration/scenarios/05.catalog/catalogs/schema.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: schema-v1 spec: - type: schema + catalogType: schema properties: spec: rules: diff --git a/test/integration/scenarios/05.catalog/catalogs/solution.yaml b/test/integration/scenarios/05.catalog/catalogs/solution.yaml index 7c14018fd..66e359df0 100644 --- a/test/integration/scenarios/05.catalog/catalogs/solution.yaml +++ b/test/integration/scenarios/05.catalog/catalogs/solution.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: solution-v1 spec: - type: solution + catalogType: solution properties: spec: displayName: site-app-v1 diff --git a/test/integration/scenarios/05.catalog/catalogs/target.yaml b/test/integration/scenarios/05.catalog/catalogs/target.yaml index 02eb26162..23289ff78 100644 --- a/test/integration/scenarios/05.catalog/catalogs/target.yaml +++ b/test/integration/scenarios/05.catalog/catalogs/target.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: target-v1 spec: - type: target + catalogType: target properties: spec: properties: diff --git a/test/integration/scenarios/05.catalog/catalogs/wrongconfig.yaml b/test/integration/scenarios/05.catalog/catalogs/wrongconfig.yaml index 363742125..f37eb2cfe 100644 --- a/test/integration/scenarios/05.catalog/catalogs/wrongconfig.yaml +++ b/test/integration/scenarios/05.catalog/catalogs/wrongconfig.yaml @@ -3,7 +3,7 @@ kind: Catalog metadata: name: wrongconfig-v1 spec: - type: config + catalogType: config metadata: schema: schema-v1 properties: