@@ -167,6 +167,25 @@ func TestAccTencentCloudKubernetesNodePoolResource_DiskEncrypt(t *testing.T) {
167167 })
168168}
169169
170+ func TestAccTencentCloudKubernetesNodePoolResource_GPUInstance (t * testing.T ) {
171+ t .Parallel ()
172+ resource .Test (t , resource.TestCase {
173+ PreCheck : func () { testAccPreCheck (t ) },
174+ Providers : testAccProviders ,
175+ CheckDestroy : testAccCheckTkeNodePoolDestroy ,
176+ Steps : []resource.TestStep {
177+ {
178+ Config : testAccTkeNodePoolClusterGpu ,
179+ Check : resource .ComposeTestCheckFunc (
180+ testAccCheckTkeNodePoolExists ,
181+ resource .TestCheckResourceAttrSet (testTkeClusterNodePoolResourceKey , "cluster_id" ),
182+ resource .TestCheckResourceAttrSet (testTkeClusterNodePoolResourceKey , "node_config.0.gpu_args.#" ),
183+ ),
184+ },
185+ },
186+ })
187+ }
188+
170189func testAccCheckTkeNodePoolDestroy (s * terraform.State ) error {
171190 logId := getLogId (contextNil )
172191 ctx := context .WithValue (context .TODO (), logIdKey , logId )
@@ -436,3 +455,93 @@ resource "tencentcloud_kubernetes_node_pool" "np_test" {
436455 unschedulable = 0
437456}
438457`
458+
459+ const testAccTkeNodePoolClusterGpu string = testAccTkeNodePoolClusterBasic + `
460+ resource "tencentcloud_kubernetes_node_pool" "np_test" {
461+ name = "gpu_args_node_pool"
462+ cluster_id = local.cluster_id
463+ max_size = 1
464+ min_size = 0
465+ vpc_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.vpc_id
466+ subnet_ids = [data.tencentcloud_vpc_subnets.vpc.instance_list.0.subnet_id]
467+ retry_policy = "INCREMENTAL_INTERVALS"
468+ desired_capacity = 1
469+ enable_auto_scale = false
470+ node_os = "ubuntu20.04x86_64"
471+ scaling_group_project_id = var.default_project
472+ delete_keep_instance = false
473+ scaling_group_name = "asg_np_test_changed"
474+ default_cooldown = 350
475+ termination_policies = ["NEWEST_INSTANCE"]
476+ multi_zone_subnet_policy = "EQUALITY"
477+
478+ auto_scaling_config {
479+ instance_type = "GN6S.LARGE20"
480+ system_disk_type = "CLOUD_PREMIUM"
481+ system_disk_size = "100"
482+ security_group_ids = [data.tencentcloud_security_groups.sg.security_groups[0].security_group_id, data.tencentcloud_security_groups.sg_as.security_groups[0].security_group_id]
483+ instance_charge_type = "SPOTPAID"
484+ spot_instance_type = "one-time"
485+ spot_max_price = "1000"
486+ cam_role_name = "TCB_QcsRole"
487+
488+ data_disk {
489+ disk_type = "CLOUD_PREMIUM"
490+ disk_size = 50
491+ delete_with_instance = true
492+ }
493+ data_disk {
494+ disk_type = "CLOUD_PREMIUM"
495+ disk_size = 100
496+ delete_with_instance = true
497+ }
498+
499+ public_ip_assigned = false
500+ password = "test123#"
501+ enhanced_security_service = true
502+ enhanced_monitor_service = false
503+ host_name = "12.123.1.1"
504+ host_name_style = "UNIQUE"
505+
506+ }
507+ unschedulable = 0
508+ labels = {
509+ "test3" = "test3",
510+ "test2" = "test2",
511+ }
512+
513+ taints {
514+ key = "test_taint"
515+ value = "taint_value"
516+ effect = "PreferNoSchedule"
517+ }
518+
519+ tags = {
520+ keep-test-np1 = "testI"
521+ keep-test-np3 = "testIII"
522+ }
523+
524+ node_config {
525+ extra_args = [
526+ "root-dir=/var/lib/kubelet"
527+ ]
528+ gpu_args {
529+ mig_enable = false
530+ driver = {
531+ name = "NVIDIA-Linux-x86_64-450.102.04.run"
532+ version = "450.102.04"
533+ }
534+ cuda = {
535+ name = "cuda_11.0.3_450.51.06_linux.run"
536+ version = "11.0.3"
537+ }
538+ cudnn = {
539+ name = "libcudnn8_8.1.0.77-1+cuda11.2_amd64.deb"
540+ version = "8.1.0"
541+ doc_name = "libcudnn8-samples_8.1.0.77-1+cuda11.2_amd64.deb"
542+ dev_name = "libcudnn8-dev_8.1.0.77-1+cuda11.2_amd64.deb"
543+ }
544+ }
545+ }
546+ }
547+ `
0 commit comments