Skip to content

Commit

Permalink
CCE: Custom deletion implementation (#565)
Browse files Browse the repository at this point in the history
CCE: Custom deletion implementation

Which issue this PR fixes
Custom CCE cluster deletion: 2254.

Reviewed-by: Rodion Gyrbu <fpsoff@outlook.com>
Reviewed-by: Anton Sidelnikov
  • Loading branch information
artem-lifshits committed Aug 10, 2023
1 parent 8e80659 commit 2b43da3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
7 changes: 6 additions & 1 deletion acceptance/openstack/cce/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ func CreateTurboCluster(t *testing.T, vpcID, subnetID string, eniSubnetID string
func DeleteCluster(t *testing.T, clusterID string) {
client, err := clients.NewCceV3Client()
th.AssertNoErr(t, err)
clusters.Delete(client, clusterID)
err = clusters.DeleteWithOpts(client, clusterID, clusters.DeleteOpts{
DeleteEfs: "true",
DeleteObs: "true",
DeleteSfs: "true",
})
th.AssertNoErr(t, err)
th.AssertNoErr(t, waitForClusterToDelete(client, clusterID, 20*60))
}

Expand Down
24 changes: 24 additions & 0 deletions openstack/cce/v3/clusters/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,30 @@ func Delete(c *golangsdk.ServiceClient, id string) (r DeleteResult) {
return
}

type DeleteOpts struct {
ErrorStatus string `q:"errorStatus"`
DeleteEfs string `q:"delete_efs"`
DeleteENI string `q:"delete_eni"`
DeleteEvs string `q:"delete_evs"`
DeleteNet string `q:"delete_net"`
DeleteObs string `q:"delete_obs"`
DeleteSfs string `q:"delete_sfs"`
}

func DeleteWithOpts(c *golangsdk.ServiceClient, id string, opts DeleteOpts) error {
url := resourceURL(c, id)
q, err := golangsdk.BuildQueryString(&opts)
if err != nil {
return err
}

_, err = c.Delete(url+q.String(), &golangsdk.RequestOpts{
OkCodes: []int{200},
MoreHeaders: RequestOpts.MoreHeaders, JSONBody: nil,
})
return err
}

type UpdateIpOpts struct {
Action string `json:"action" required:"true"`
Spec IpSpec `json:"spec,omitempty"`
Expand Down

0 comments on commit 2b43da3

Please sign in to comment.