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): do not update autoscaled pool size #265

Merged
merged 4 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 8 additions & 6 deletions scaleway/resource_k8s_cluster_beta.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,6 @@ func resourceScalewayK8SClusterBetaDefaultPoolUpdate(d *schema.ResourceData, m i
PoolID: defaultPoolID,
}

if autoscaling, ok := d.GetOk("default_pool.0.autoscaling"); ok {
updateRequest.Autoscaling = scw.BoolPtr(autoscaling.(bool))
}

if minSize, ok := d.GetOk("default_pool.0.min_size"); ok {
updateRequest.MinSize = scw.Uint32Ptr(uint32(minSize.(int)))
}
Expand All @@ -488,8 +484,14 @@ func resourceScalewayK8SClusterBetaDefaultPoolUpdate(d *schema.ResourceData, m i
updateRequest.MaxSize = scw.Uint32Ptr(uint32(maxSize.(int)))
}

if size, ok := d.GetOk("default_pool.0.size"); ok {
updateRequest.Size = scw.Uint32Ptr(uint32(size.(int)))
if autoscaling, ok := d.GetOk("default_pool.0.autoscaling"); ok {
updateRequest.Autoscaling = scw.BoolPtr(autoscaling.(bool))
}

if d.Get("default_pool.0.autoscaling").(bool) == false {
if size, ok := d.GetOk("default_pool.0.size"); ok {
updateRequest.Size = scw.Uint32Ptr(uint32(size.(int)))
}
}

_, err := k8sAPI.UpdatePool(updateRequest)
Expand Down
6 changes: 4 additions & 2 deletions scaleway/resource_k8s_pool_beta.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,10 @@ func resourceScalewayK8SPoolBetaUpdate(d *schema.ResourceData, m interface{}) er
updateRequest.MaxSize = scw.Uint32Ptr(uint32(d.Get("max_size").(int)))
}

if d.HasChange("size") {
updateRequest.Size = scw.Uint32Ptr(uint32(d.Get("size").(int)))
if d.Get("autoscaling").(bool) == false {
Sh4d1 marked this conversation as resolved.
Show resolved Hide resolved
if d.HasChange("size") {
updateRequest.Size = scw.Uint32Ptr(uint32(d.Get("size").(int)))
}
}

_, err = k8sAPI.UpdatePool(updateRequest)
Expand Down