Skip to content

Commit

Permalink
Merge pull request #152 from volcengine/feat/vke
Browse files Browse the repository at this point in the history
Feat/vke
  • Loading branch information
zpp12354321 authored Dec 18, 2023
2 parents a19ecb2 + 8dee57c commit 082d246
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion common/common_volcengine_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package common

const (
TerraformProviderName = "terraform-provider-volcengine"
TerraformProviderVersion = "0.0.131"
TerraformProviderVersion = "0.0.132"
)
1 change: 1 addition & 0 deletions volcengine/vke/addon/service_volcengine_vke_addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ func (s *VolcengineVkeAddonService) RemoveResource(resourceData *schema.Resource
}
(*call.SdkParam)["ClusterId"] = ids[0]
(*call.SdkParam)["Name"] = ids[1]
(*call.SdkParam)["RetainResources"] = []string{}
(*call.SdkParam)["CascadingDeleteResources"] = []string{"Crd"}
return true, nil
},
Expand Down
3 changes: 2 additions & 1 deletion volcengine/vke/cluster/service_volcengine_vke_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ func (s *VolcengineVkeClusterService) RemoveResource(resourceData *schema.Resour
ConvertMode: ve.RequestConvertIgnore,
BeforeCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (bool, error) {
(*call.SdkParam)["Id"] = resourceData.Id()
(*call.SdkParam)["CascadingDeleteResources"] = []string{"NodePoolResource", "Clb", "Nat"}
(*call.SdkParam)["RetainResources"] = []string{}
(*call.SdkParam)["CascadingDeleteResources"] = []string{"All"}
return true, nil
},
ExecuteCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (*map[string]interface{}, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,9 @@ func (s *VolcengineDefaultNodePoolService) RemoveResource(resourceData *schema.R
ConvertMode: ve.RequestConvertIgnore,
ContentType: ve.ContentTypeJson,
SdkParam: &map[string]interface{}{
"Id": resourceData.Id(),
"ClusterId": resourceData.Get("cluster_id"),
"Id": resourceData.Id(),
"ClusterId": resourceData.Get("cluster_id"),
"RetainResources": []string{"Ecs"},
},
ExecuteCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (*map[string]interface{}, error) {
logger.Debug(logger.RespFormat, call.Action, call.SdkParam)
Expand Down
7 changes: 4 additions & 3 deletions volcengine/vke/node/service_volcengine_vke_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,10 @@ func (s *VolcengineVkeNodeService) RemoveResource(resourceData *schema.ResourceD
ConvertMode: ve.RequestConvertIgnore,
ContentType: ve.ContentTypeJson,
SdkParam: &map[string]interface{}{
"ClusterId": resourceData.Get("cluster_id"),
"NodePoolId": resourceData.Get("node_pool_id"),
"Ids.1": resourceData.Id(),
"ClusterId": resourceData.Get("cluster_id"),
"NodePoolId": resourceData.Get("node_pool_id"),
"Ids.1": resourceData.Id(),
"RetainResources": []string{"Ecs"},
},
BeforeCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (bool, error) {
nodePool, err := s.nodePoolService.ReadResources(map[string]interface{}{
Expand Down
8 changes: 4 additions & 4 deletions volcengine/vke/node_pool/resource_volcengine_vke_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ func ResourceVolcengineNodePool() *schema.Resource {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Is Enabled of AutoScaling.",
Description: "Whether to enable the auto scaling function of the node pool. When a node needs to be manually added to the node pool, the value of this field must be `false`.",
},
"max_replicas": {
Type: schema.TypeInt,
Optional: true,
Default: 10,
ValidateFunc: validation.IntBetween(1, 2000),
Description: "The MaxReplicas of AutoScaling, default 10, range in 1~2000.",
Description: "The MaxReplicas of AutoScaling, default 10, range in 1~2000. This field is valid when the value of `enabled` is `true`.",
},
"min_replicas": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "The MinReplicas of AutoScaling, default 0.",
Description: "The MinReplicas of AutoScaling, default 0. This field is valid when the value of `enabled` is `true`.",
},
"desired_replicas": {
Type: schema.TypeInt,
Expand All @@ -88,7 +88,7 @@ func ResourceVolcengineNodePool() *schema.Resource {
Optional: true,
Computed: true,
ValidateFunc: validation.IntBetween(0, 100),
Description: "The Priority of AutoScaling, default 10, rang in 0~100.",
Description: "The Priority of AutoScaling, default 10, rang in 0~100. This field is valid when the value of `enabled` is `true` and the value of `subnet_policy` is `Priority`.",
},
"subnet_policy": {
Type: schema.TypeString,
Expand Down
3 changes: 2 additions & 1 deletion volcengine/vke/node_pool/service_volcengine_vke_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,8 @@ func (s *VolcengineNodePoolService) RemoveResource(resourceData *schema.Resource
SdkParam: &map[string]interface{}{
"Id": resourceData.Id(),
"ClusterId": resourceData.Get("cluster_id"),
"CascadingDeleteResources": [1]string{"Ecs"},
"RetainResources": []string{},
"CascadingDeleteResources": []string{"Ecs"},
},
ExecuteCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (*map[string]interface{}, error) {
logger.Debug(logger.RespFormat, call.Action, call.SdkParam)
Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/vke_node_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ The following arguments are supported:
The `auto_scaling` object supports the following:

* `desired_replicas` - (Optional) The DesiredReplicas of AutoScaling, default 0, range in min_replicas to max_replicas.
* `enabled` - (Optional) Is Enabled of AutoScaling.
* `max_replicas` - (Optional) The MaxReplicas of AutoScaling, default 10, range in 1~2000.
* `min_replicas` - (Optional) The MinReplicas of AutoScaling, default 0.
* `priority` - (Optional) The Priority of AutoScaling, default 10, rang in 0~100.
* `enabled` - (Optional) Whether to enable the auto scaling function of the node pool. When a node needs to be manually added to the node pool, the value of this field must be `false`.
* `max_replicas` - (Optional) The MaxReplicas of AutoScaling, default 10, range in 1~2000. This field is valid when the value of `enabled` is `true`.
* `min_replicas` - (Optional) The MinReplicas of AutoScaling, default 0. This field is valid when the value of `enabled` is `true`.
* `priority` - (Optional) The Priority of AutoScaling, default 10, rang in 0~100. This field is valid when the value of `enabled` is `true` and the value of `subnet_policy` is `Priority`.
* `subnet_policy` - (Optional) Multi-subnet scheduling strategy for nodes. The value can be `ZoneBalance` or `Priority`.

The `data_volumes` object supports the following:
Expand Down

0 comments on commit 082d246

Please sign in to comment.