From 1fc90f15489ae3eafeb5994f5285f09750feae4c Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Wed, 30 Sep 2020 22:38:59 -0700 Subject: Ovnaction and vfw updates for deploy api change Update the ovnaction controller APIs to support the api change of including the deployment intent group in the URL. Also fixup: - vfw and other test cases to support the change - updates to emcoctl tool and examples Issue-ID: MULTICLOUD-1218 Signed-off-by: Eric Multanen Change-Id: Icadacb5ec6d7c238bb3bf8a44a39c30692ecebee --- src/ovnaction/pkg/module/workloadifintent.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/ovnaction/pkg/module/workloadifintent.go') diff --git a/src/ovnaction/pkg/module/workloadifintent.go b/src/ovnaction/pkg/module/workloadifintent.go index 55062564..cea336f6 100644 --- a/src/ovnaction/pkg/module/workloadifintent.go +++ b/src/ovnaction/pkg/module/workloadifintent.go @@ -41,6 +41,7 @@ type WorkloadIfIntentKey struct { Project string `json:"provider"` CompositeApp string `json:"compositeapp"` CompositeAppVersion string `json:"compositeappversion"` + DigName string `json:"deploymentintentgroup"` NetControlIntent string `json:"netcontrolintent"` WorkloadIntent string `json:"workloadintent"` WorkloadIfIntent string `json:"workloadifintent"` @@ -48,10 +49,10 @@ type WorkloadIfIntentKey struct { // Manager is an interface exposing the WorkloadIfIntent functionality type WorkloadIfIntentManager interface { - CreateWorkloadIfIntent(wi WorkloadIfIntent, project, compositeapp, compositeappversion, netcontrolintent, workloadintent string, exists bool) (WorkloadIfIntent, error) - GetWorkloadIfIntent(name, project, compositeapp, compositeappversion, netcontrolintent, workloadintent string) (WorkloadIfIntent, error) - GetWorkloadIfIntents(project, compositeapp, compositeappversion, netcontrolintent, workloadintent string) ([]WorkloadIfIntent, error) - DeleteWorkloadIfIntent(name, project, compositeapp, compositeappversion, netcontrolintent, workloadintent string) error + CreateWorkloadIfIntent(wi WorkloadIfIntent, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string, exists bool) (WorkloadIfIntent, error) + GetWorkloadIfIntent(name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) (WorkloadIfIntent, error) + GetWorkloadIfIntents(project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) ([]WorkloadIfIntent, error) + DeleteWorkloadIfIntent(name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) error } // WorkloadIfIntentClient implements the Manager @@ -72,26 +73,27 @@ func NewWorkloadIfIntentClient() *WorkloadIfIntentClient { } // CreateWorkloadIfIntent - create a new WorkloadIfIntent -func (v *WorkloadIfIntentClient) CreateWorkloadIfIntent(wif WorkloadIfIntent, project, compositeapp, compositeappversion, netcontrolintent, workloadintent string, exists bool) (WorkloadIfIntent, error) { +func (v *WorkloadIfIntentClient) CreateWorkloadIfIntent(wif WorkloadIfIntent, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string, exists bool) (WorkloadIfIntent, error) { //Construct key and tag to select the entry key := WorkloadIfIntentKey{ Project: project, CompositeApp: compositeapp, CompositeAppVersion: compositeappversion, + DigName: dig, NetControlIntent: netcontrolintent, WorkloadIntent: workloadintent, WorkloadIfIntent: wif.Metadata.Name, } //Check if the Workload Intent exists - _, err := NewWorkloadIntentClient().GetWorkloadIntent(workloadintent, project, compositeapp, compositeappversion, netcontrolintent) + _, err := NewWorkloadIntentClient().GetWorkloadIntent(workloadintent, project, compositeapp, compositeappversion, dig, netcontrolintent) if err != nil { return WorkloadIfIntent{}, pkgerrors.Errorf("Workload Intent %v does not exist", workloadintent) } //Check if this WorkloadIfIntent already exists - _, err = v.GetWorkloadIfIntent(wif.Metadata.Name, project, compositeapp, compositeappversion, netcontrolintent, workloadintent) + _, err = v.GetWorkloadIfIntent(wif.Metadata.Name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent) if err == nil && !exists { return WorkloadIfIntent{}, pkgerrors.New("WorkloadIfIntent already exists") } @@ -105,13 +107,14 @@ func (v *WorkloadIfIntentClient) CreateWorkloadIfIntent(wif WorkloadIfIntent, pr } // GetWorkloadIfIntent returns the WorkloadIfIntent for corresponding name -func (v *WorkloadIfIntentClient) GetWorkloadIfIntent(name, project, compositeapp, compositeappversion, netcontrolintent, workloadintent string) (WorkloadIfIntent, error) { +func (v *WorkloadIfIntentClient) GetWorkloadIfIntent(name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) (WorkloadIfIntent, error) { //Construct key and tag to select the entry key := WorkloadIfIntentKey{ Project: project, CompositeApp: compositeapp, CompositeAppVersion: compositeappversion, + DigName: dig, NetControlIntent: netcontrolintent, WorkloadIntent: workloadintent, WorkloadIfIntent: name, @@ -136,13 +139,14 @@ func (v *WorkloadIfIntentClient) GetWorkloadIfIntent(name, project, compositeapp } // GetWorkloadIfIntentList returns all of the WorkloadIfIntent for corresponding name -func (v *WorkloadIfIntentClient) GetWorkloadIfIntents(project, compositeapp, compositeappversion, netcontrolintent, workloadintent string) ([]WorkloadIfIntent, error) { +func (v *WorkloadIfIntentClient) GetWorkloadIfIntents(project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) ([]WorkloadIfIntent, error) { //Construct key and tag to select the entry key := WorkloadIfIntentKey{ Project: project, CompositeApp: compositeapp, CompositeAppVersion: compositeappversion, + DigName: dig, NetControlIntent: netcontrolintent, WorkloadIntent: workloadintent, WorkloadIfIntent: "", @@ -167,13 +171,14 @@ func (v *WorkloadIfIntentClient) GetWorkloadIfIntents(project, compositeapp, com } // Delete the WorkloadIfIntent from database -func (v *WorkloadIfIntentClient) DeleteWorkloadIfIntent(name, project, compositeapp, compositeappversion, netcontrolintent, workloadintent string) error { +func (v *WorkloadIfIntentClient) DeleteWorkloadIfIntent(name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) error { //Construct key and tag to select the entry key := WorkloadIfIntentKey{ Project: project, CompositeApp: compositeapp, CompositeAppVersion: compositeappversion, + DigName: dig, NetControlIntent: netcontrolintent, WorkloadIntent: workloadintent, WorkloadIfIntent: name, -- cgit 1.2.3-korg