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): set waiting pool ready as mandatory #1045

Merged
merged 4 commits into from
Jan 17, 2022
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
2 changes: 1 addition & 1 deletion scaleway/helpers_k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (
defaultK8SPoolTimeout = 10 * time.Minute
K8SClusterWaitForPoolRequiredTimeout = 10 * time.Minute
K8SClusterWaitForDeletedTimeout = 10 * time.Minute
K8SPoolWaitForReadyTimeout = 10 * time.Minute
K8SPoolWaitForReadyTimeout = 15 * time.Minute
)

func k8sAPIWithRegion(d *schema.ResourceData, m interface{}) (*k8s.API, scw.Region, error) {
Expand Down
10 changes: 5 additions & 5 deletions scaleway/resource_k8s_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func resourceScalewayK8SPool() *schema.Resource {
"wait_for_pool_ready": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Default: true,
Description: "Whether to wait for the pool to be ready",
},
"placement_group_id": {
Expand Down Expand Up @@ -277,15 +277,15 @@ func resourceScalewayK8SPoolCreate(ctx context.Context, d *schema.ResourceData,

d.SetId(newRegionalIDString(region, res.ID))

if waitForCluster {
_, err = waitK8SCluster(ctx, k8sAPI, region, cluster.ID)
if d.Get("wait_for_pool_ready").(bool) { // wait for the pool to be ready if specified (including all its nodes)
err = waitK8SPoolReady(ctx, k8sAPI, region, res.ID)
if err != nil {
return diag.FromErr(err)
}
}

if d.Get("wait_for_pool_ready").(bool) { // wait for the pool to be ready if specified (including all its nodes)
err = waitK8SPoolReady(ctx, k8sAPI, region, res.ID)
if waitForCluster {
_, err = waitK8SCluster(ctx, k8sAPI, region, cluster.ID)
if err != nil {
return diag.FromErr(err)
}
Expand Down
3,661 changes: 3,332 additions & 329 deletions scaleway/testdata/data-source-k8s-cluster-basic.cassette.yaml

Large diffs are not rendered by default.

4,794 changes: 4,426 additions & 368 deletions scaleway/testdata/data-source-k8s-pool-basic.cassette.yaml

Large diffs are not rendered by default.

736 changes: 368 additions & 368 deletions scaleway/testdata/k8s-cluster-auto-upgrade.cassette.yaml

Large diffs are not rendered by default.

257 changes: 145 additions & 112 deletions scaleway/testdata/k8s-cluster-autoscaling.cassette.yaml

Large diffs are not rendered by default.

628 changes: 147 additions & 481 deletions scaleway/testdata/k8s-cluster-basic.cassette.yaml

Large diffs are not rendered by default.

2,752 changes: 2,036 additions & 716 deletions scaleway/testdata/k8s-cluster-oidc.cassette.yaml

Large diffs are not rendered by default.

4,141 changes: 3,819 additions & 322 deletions scaleway/testdata/k8s-cluster-pool-basic.cassette.yaml

Large diffs are not rendered by default.

2,733 changes: 2,455 additions & 278 deletions scaleway/testdata/k8s-cluster-pool-kubelet-args.cassette.yaml

Large diffs are not rendered by default.

2,807 changes: 2,509 additions & 298 deletions scaleway/testdata/k8s-cluster-pool-placement-group.cassette.yaml

Large diffs are not rendered by default.

3,108 changes: 2,824 additions & 284 deletions scaleway/testdata/k8s-cluster-pool-upgrade-policy.cassette.yaml

Large diffs are not rendered by default.

4,297 changes: 3,004 additions & 1,293 deletions scaleway/testdata/k8s-cluster-pool-wait.cassette.yaml

Large diffs are not rendered by default.

2,104 changes: 1,893 additions & 211 deletions scaleway/testdata/k8s-cluster-pool-zone.cassette.yaml

Large diffs are not rendered by default.