Skip to content

Commit

Permalink
fix(k8s): do not update autoscaled pool size (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh4d1 authored and QuentinBrosse committed Oct 10, 2019
1 parent c0667c4 commit 2bd47a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions scaleway/resource_k8s_cluster_beta.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,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 autohealing, ok := d.GetOk("default_pool.0.autohealing"); ok {
updateRequest.Autohealing = scw.BoolPtr(autohealing.(bool))
}
Expand All @@ -507,8 +503,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
2 changes: 1 addition & 1 deletion scaleway/resource_k8s_pool_beta.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func resourceScalewayK8SPoolBetaUpdate(d *schema.ResourceData, m interface{}) er
updateRequest.MaxSize = scw.Uint32Ptr(uint32(d.Get("max_size").(int)))
}

if d.HasChange("size") {
if d.Get("autoscaling").(bool) == false && d.HasChange("size") {
updateRequest.Size = scw.Uint32Ptr(uint32(d.Get("size").(int)))
}

Expand Down

0 comments on commit 2bd47a4

Please sign in to comment.