From 7a868565d1e8615c26cc0a27bf981d2f053a2a21 Mon Sep 17 00:00:00 2001 From: SevenEarth <45937856+SevenEarth@users.noreply.github.com> Date: Tue, 24 Dec 2024 14:09:03 +0800 Subject: [PATCH] fix(tke): [121134414] `tencentcloud_kubernetes_node_pool` support CBM for `instance_type` (#3034) * add * add * add --- .changelog/3034.txt | 3 + tencentcloud/services/as/extension_as.go | 2 + .../tke/resource_tc_kubernetes_node_pool.go | 4 +- .../tke/resource_tc_kubernetes_node_pool.md | 54 ++++++++++++++++- .../docs/r/kubernetes_node_pool.html.markdown | 58 +++++++++++++++++-- 5 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 .changelog/3034.txt diff --git a/.changelog/3034.txt b/.changelog/3034.txt new file mode 100644 index 0000000000..9577132892 --- /dev/null +++ b/.changelog/3034.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_kubernetes_node_pool: support CBM for `instance_type` +``` \ No newline at end of file diff --git a/tencentcloud/services/as/extension_as.go b/tencentcloud/services/as/extension_as.go index dac8d3ebd3..a15094b0fa 100644 --- a/tencentcloud/services/as/extension_as.go +++ b/tencentcloud/services/as/extension_as.go @@ -9,6 +9,7 @@ const ( SYSTEM_DISK_TYPE_CLOUD_HSSD = "CLOUD_HSSD" SYSTEM_DISK_TYPE_CLOUD_BSSD = "CLOUD_BSSD" SYSTEM_DISK_TYPE_CLOUD_TSSD = "CLOUD_TSSD" + SYSTEM_DISK_TYPE_LOCAL_NVME = "LOCAL_NVME" ) var SYSTEM_DISK_ALLOW_TYPE = []string{ @@ -20,6 +21,7 @@ var SYSTEM_DISK_ALLOW_TYPE = []string{ SYSTEM_DISK_TYPE_CLOUD_HSSD, SYSTEM_DISK_TYPE_CLOUD_TSSD, SYSTEM_DISK_TYPE_CLOUD_BSSD, + SYSTEM_DISK_TYPE_LOCAL_NVME, } const ( diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_node_pool.go b/tencentcloud/services/tke/resource_tc_kubernetes_node_pool.go index 3d246269a0..44b294ecf5 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_node_pool.go +++ b/tencentcloud/services/tke/resource_tc_kubernetes_node_pool.go @@ -168,7 +168,7 @@ func ResourceTencentCloudKubernetesNodePool() *schema.Resource { Optional: true, ForceNew: true, Default: "CLOUD_PREMIUM", - Description: "Types of disk. Valid value: `LOCAL_BASIC`, `LOCAL_SSD`, `CLOUD_BASIC`, `CLOUD_PREMIUM`, `CLOUD_SSD`, `CLOUD_HSSD`, `CLOUD_TSSD` and `CLOUD_BSSD`.", + Description: "Types of disk. Valid value: `LOCAL_BASIC`, `LOCAL_SSD`, `CLOUD_BASIC`, `CLOUD_PREMIUM`, `CLOUD_SSD`, `CLOUD_HSSD`, `CLOUD_TSSD`, `CLOUD_BSSD` and `LOCAL_NVME`.", ValidateFunc: tccommon.ValidateAllowedStringValue(svcas.SYSTEM_DISK_ALLOW_TYPE), }, "disk_size": { @@ -311,7 +311,7 @@ func ResourceTencentCloudKubernetesNodePool() *schema.Resource { Type: schema.TypeString, Optional: true, Default: "CLOUD_PREMIUM", - Description: "Type of a CVM disk. Valid value: `LOCAL_BASIC`, `LOCAL_SSD`, `CLOUD_BASIC`, `CLOUD_PREMIUM`, `CLOUD_SSD`, `CLOUD_HSSD`, `CLOUD_TSSD` and `CLOUD_BSSD`. Default is `CLOUD_PREMIUM`.", + Description: "Type of a CVM disk. Valid value: `LOCAL_BASIC`, `LOCAL_SSD`, `CLOUD_BASIC`, `CLOUD_PREMIUM`, `CLOUD_SSD`, `CLOUD_HSSD`, `CLOUD_TSSD`, `CLOUD_BSSD` and `LOCAL_NVME`. Default is `CLOUD_PREMIUM`.", ValidateFunc: tccommon.ValidateAllowedStringValue(svcas.SYSTEM_DISK_ALLOW_TYPE), }, "system_disk_size": { diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_node_pool.md b/tencentcloud/services/tke/resource_tc_kubernetes_node_pool.md index f55bb23be6..aa918d60b7 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_node_pool.md +++ b/tencentcloud/services/tke/resource_tc_kubernetes_node_pool.md @@ -68,7 +68,7 @@ resource "tencentcloud_kubernetes_node_pool" "example" { internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" internet_max_bandwidth_out = 10 public_ip_assigned = true - password = "test123#" + password = "Password@123" enhanced_security_service = false enhanced_monitor_service = false host_name = "12.123.0.0" @@ -133,7 +133,7 @@ resource "tencentcloud_kubernetes_node_pool" "example" { internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" internet_max_bandwidth_out = 10 public_ip_assigned = true - password = "test123#" + password = "Password@123" enhanced_security_service = false enhanced_monitor_service = false } @@ -145,6 +145,56 @@ resource "tencentcloud_kubernetes_node_pool" "example" { } ``` +If instance_type is CBM + +```hcl +resource "tencentcloud_kubernetes_node_pool" "example" { + name = "tf-example" + cluster_id = "cls-23ieal0c" + max_size = 100 + min_size = 1 + vpc_id = "vpc-i5yyodl9" + subnet_ids = ["subnet-d4umunpy"] + retry_policy = "INCREMENTAL_INTERVALS" + enable_auto_scale = true + multi_zone_subnet_policy = "EQUALITY" + node_os = "img-eb30mz89" + delete_keep_instance = false + + node_config { + data_disk { + disk_type = "LOCAL_NVME" + disk_size = 3570 + file_system = "ext4" + mount_target = "/var/lib/data1" + } + + data_disk { + disk_type = "LOCAL_NVME" + disk_size = 3570 + file_system = "ext4" + mount_target = "/var/lib/data2" + } + } + + auto_scaling_config { + instance_type = "BMI5.24XLARGE384" + system_disk_type = "LOCAL_BASIC" + system_disk_size = "440" + orderly_security_group_ids = ["sg-4z20n68d"] + + internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" + internet_max_bandwidth_out = 10 + public_ip_assigned = true + password = "Password@123" + enhanced_security_service = false + enhanced_monitor_service = false + host_name = "example" + host_name_style = "ORIGINAL" + } +} +``` + Wait for all scaling nodes to be ready with wait_node_ready and scale_tolerance parameters. The default maximum scaling timeout is 30 minutes. ```hcl diff --git a/website/docs/r/kubernetes_node_pool.html.markdown b/website/docs/r/kubernetes_node_pool.html.markdown index 5ff088c6f0..75252221b9 100644 --- a/website/docs/r/kubernetes_node_pool.html.markdown +++ b/website/docs/r/kubernetes_node_pool.html.markdown @@ -79,7 +79,7 @@ resource "tencentcloud_kubernetes_node_pool" "example" { internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" internet_max_bandwidth_out = 10 public_ip_assigned = true - password = "test123#" + password = "Password@123" enhanced_security_service = false enhanced_monitor_service = false host_name = "12.123.0.0" @@ -144,7 +144,7 @@ resource "tencentcloud_kubernetes_node_pool" "example" { internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" internet_max_bandwidth_out = 10 public_ip_assigned = true - password = "test123#" + password = "Password@123" enhanced_security_service = false enhanced_monitor_service = false } @@ -156,6 +156,56 @@ resource "tencentcloud_kubernetes_node_pool" "example" { } ``` +### If instance_type is CBM + +```hcl +resource "tencentcloud_kubernetes_node_pool" "example" { + name = "tf-example" + cluster_id = "cls-23ieal0c" + max_size = 100 + min_size = 1 + vpc_id = "vpc-i5yyodl9" + subnet_ids = ["subnet-d4umunpy"] + retry_policy = "INCREMENTAL_INTERVALS" + enable_auto_scale = true + multi_zone_subnet_policy = "EQUALITY" + node_os = "img-eb30mz89" + delete_keep_instance = false + + node_config { + data_disk { + disk_type = "LOCAL_NVME" + disk_size = 3570 + file_system = "ext4" + mount_target = "/var/lib/data1" + } + + data_disk { + disk_type = "LOCAL_NVME" + disk_size = 3570 + file_system = "ext4" + mount_target = "/var/lib/data2" + } + } + + auto_scaling_config { + instance_type = "BMI5.24XLARGE384" + system_disk_type = "LOCAL_BASIC" + system_disk_size = "440" + orderly_security_group_ids = ["sg-4z20n68d"] + + internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" + internet_max_bandwidth_out = 10 + public_ip_assigned = true + password = "Password@123" + enhanced_security_service = false + enhanced_monitor_service = false + host_name = "example" + host_name_style = "ORIGINAL" + } +} +``` + ### Wait for all scaling nodes to be ready with wait_node_ready and scale_tolerance parameters. The default maximum scaling timeout is 30 minutes. ```hcl @@ -294,7 +344,7 @@ The `auto_scaling_config` object supports the following: * `spot_instance_type` - (Optional, String) Type of spot instance, only support `one-time` now. Note: it only works when instance_charge_type is set to `SPOTPAID`. * `spot_max_price` - (Optional, String) Max price of a spot instance, is the format of decimal string, for example "0.50". Note: it only works when instance_charge_type is set to `SPOTPAID`. * `system_disk_size` - (Optional, Int) Volume of system disk in GB. Default is `50`. -* `system_disk_type` - (Optional, String) Type of a CVM disk. Valid value: `LOCAL_BASIC`, `LOCAL_SSD`, `CLOUD_BASIC`, `CLOUD_PREMIUM`, `CLOUD_SSD`, `CLOUD_HSSD`, `CLOUD_TSSD` and `CLOUD_BSSD`. Default is `CLOUD_PREMIUM`. +* `system_disk_type` - (Optional, String) Type of a CVM disk. Valid value: `LOCAL_BASIC`, `LOCAL_SSD`, `CLOUD_BASIC`, `CLOUD_PREMIUM`, `CLOUD_SSD`, `CLOUD_HSSD`, `CLOUD_TSSD`, `CLOUD_BSSD` and `LOCAL_NVME`. Default is `CLOUD_PREMIUM`. The `data_disk` object of `auto_scaling_config` supports the following: @@ -310,7 +360,7 @@ The `data_disk` object of `node_config` supports the following: * `auto_format_and_mount` - (Optional, Bool, ForceNew) Indicate whether to auto format and mount or not. Default is `false`. * `disk_partition` - (Optional, String, ForceNew) The name of the device or partition to mount. NOTE: this argument doesn't support setting in node pool, or will leads to mount error. * `disk_size` - (Optional, Int, ForceNew) Volume of disk in GB. Default is `0`. -* `disk_type` - (Optional, String, ForceNew) Types of disk. Valid value: `LOCAL_BASIC`, `LOCAL_SSD`, `CLOUD_BASIC`, `CLOUD_PREMIUM`, `CLOUD_SSD`, `CLOUD_HSSD`, `CLOUD_TSSD` and `CLOUD_BSSD`. +* `disk_type` - (Optional, String, ForceNew) Types of disk. Valid value: `LOCAL_BASIC`, `LOCAL_SSD`, `CLOUD_BASIC`, `CLOUD_PREMIUM`, `CLOUD_SSD`, `CLOUD_HSSD`, `CLOUD_TSSD`, `CLOUD_BSSD` and `LOCAL_NVME`. * `file_system` - (Optional, String, ForceNew) File system, e.g. `ext3/ext4/xfs`. * `mount_target` - (Optional, String, ForceNew) Mount target.