Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDKQE-3396: Add ability to modify cloud columnar instances #65

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions deployment/clouddeploy/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,36 @@ func (d *Deployer) ModifyCluster(ctx context.Context, clusterID string, def *clu
return err
}

if clusterInfo.Columnar != nil {
d.logger.Warn("can only modify the node count for a columnar cluster")

newSpec := &capellacontrol.UpdateColumnarInstanceRequest{
Name: clusterInfo.Columnar.Name,
Description: clusterInfo.Columnar.Description,
Nodes: def.NodeGroups[0].Count,
}
err = d.client.UpdateColumnarSpecs(ctx, clusterInfo.Columnar.TenantID, clusterInfo.Columnar.ProjectID, clusterInfo.Columnar.ID, newSpec)
if err != nil {
return errors.Wrap(err, "failed to update specs")
}

d.logger.Debug("waiting for columnar modification to begin")

err = d.mgr.WaitForClusterState(ctx, d.tenantID, clusterInfo.Columnar.ID, "scaling")
if err != nil {
return errors.Wrap(err, "failed to wait for columnar modification to begin")
}

d.logger.Debug("waiting for columnar to be healthy")

err = d.mgr.WaitForClusterState(ctx, d.tenantID, clusterInfo.Columnar.ID, "healthy")
if err != nil {
return errors.Wrap(err, "failed to wait for columnar to be healthy")
}

return nil
}

cloudProjectID := clusterInfo.Cluster.Project.Id
cloudClusterID := clusterInfo.Cluster.Id
cloudProvider := clusterInfo.Cluster.Provider.Name
Expand Down
18 changes: 18 additions & 0 deletions utils/capellacontrol/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,12 @@ type CreateColumnarInstanceRequest struct {
AvailabilityZone string `json:"availabilityZone"`
}

type UpdateColumnarInstanceRequest struct {
Name string `json:"name"`
Description string `json:"description"`
Nodes int `json:"nodes"`
}

type ColumnarInstanceTypes struct {
VCPUs string `json:"vcpus"`
Memory string `json:"memory"`
Expand Down Expand Up @@ -872,6 +878,18 @@ func (c *Controller) UpdateClusterSpecs(
return nil
}

func (c *Controller) UpdateColumnarSpecs(
ctx context.Context,
tenantID string,
projectID string,
columnarID string,
req *UpdateColumnarInstanceRequest,
) error {
path := fmt.Sprintf("/v2/organizations/%s/projects/%s/instance/%s", tenantID, projectID, columnarID)
err := c.doBasicReq(ctx, false, "PATCH", path, req, nil)
return err
}

type ClusterJobInfo struct {
JobType string `json:"jobType"`
ID string `json:"id"`
Expand Down
Loading