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

fix(k8s): return cluster on wait flags #776

Merged
merged 1 commit into from
Mar 16, 2020
Merged
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
8 changes: 4 additions & 4 deletions internal/namespaces/k8s/v1beta4/custom_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ func clusterUpdateBuilder(c *core.Command) *core.Command {

func waitForClusterFunc(action int) core.WaitFunc {
return func(ctx context.Context, _, respI interface{}) (interface{}, error) {
_, err := k8s.NewAPI(core.ExtractClient(ctx)).WaitForCluster(&k8s.WaitForClusterRequest{
cluster, err := k8s.NewAPI(core.ExtractClient(ctx)).WaitForCluster(&k8s.WaitForClusterRequest{
Region: respI.(*k8s.Cluster).Region,
ClusterID: respI.(*k8s.Cluster).ID,
Timeout: scw.DurationPtr(clusterActionTimeout),
})
switch action {
case clusterActionCreate:
return fmt.Sprintf("Cluster %s successfully created.", respI.(*k8s.Cluster).ID), nil
return cluster, err
case clusterActionUpdate:
return fmt.Sprintf("Cluster %s successfully updated.", respI.(*k8s.Cluster).ID), nil
return cluster, err
case clusterActionUpgrade:
return fmt.Sprintf("Cluster %s successfully upgraded.", respI.(*k8s.Cluster).ID), nil
return cluster, err
case clusterActionDelete:
if err != nil {
// if we get a 404 here, it means the resource was successfully deleted
Expand Down