@@ -382,3 +382,302 @@ def test_cluster_nodes_recycle(lke_cluster):
382382 cluster_id = lke_cluster
383383
384384 exec_test_command (BASE_CMDS ["lke" ] + ["cluster-nodes-recycle" , cluster_id ])
385+
386+
387+ def test_create_cluster_with_apl_enabled (monkeypatch ):
388+ """
389+ Test creating an LKE cluster with apl_enabled=true using v4beta API.
390+ """
391+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
392+
393+ label = get_random_text (8 ) + "_apl_enabled_cluster"
394+
395+ test_region = get_random_region_with_caps (
396+ required_capabilities = ["Linodes" , "Kubernetes" ]
397+ )
398+ lke_version = exec_test_command (
399+ BASE_CMDS ["lke" ]
400+ + [
401+ "versions-list" ,
402+ "--text" ,
403+ "--no-headers" ,
404+ ]
405+ ).splitlines ()[0 ]
406+
407+ # Create cluster with apl_enabled=true
408+ cluster_label = exec_test_command (
409+ BASE_CMDS ["lke" ]
410+ + [
411+ "cluster-create" ,
412+ "--region" ,
413+ test_region ,
414+ "--label" ,
415+ label ,
416+ "--node_pools.type" ,
417+ "g6-dedicated-8" , # APL requires higher specs
418+ "--node_pools.count" ,
419+ "3" , # APL requires minimum 3 nodes
420+ "--node_pools.disks" ,
421+ '[{"type":"ext4","size":1024}]' ,
422+ "--k8s_version" ,
423+ lke_version ,
424+ "--tier" ,
425+ "standard" ,
426+ "--apl_enabled" ,
427+ "true" ,
428+ "--text" ,
429+ "--delimiter" ,
430+ "," ,
431+ "--no-headers" ,
432+ "--format=label" ,
433+ ]
434+ )
435+
436+ assert label == cluster_label
437+
438+ cluster_id = get_cluster_id (label = cluster_label )
439+
440+ # Verify apl_enabled is set to true
441+ res = exec_test_command (
442+ BASE_CMDS ["lke" ] + ["cluster-view" , cluster_id , "--json" ]
443+ )
444+ cluster_data = json .loads (res )
445+ assert cluster_data [0 ]["apl_enabled" ] is True
446+
447+ delete_target_id (
448+ target = "lke" , id = cluster_id , delete_command = "cluster-delete"
449+ )
450+
451+
452+ def test_create_cluster_with_apl_disabled (monkeypatch ):
453+ """
454+ Test creating an LKE cluster with apl_enabled=false.
455+ """
456+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
457+
458+ label = get_random_text (8 ) + "_apl_disabled_cluster"
459+
460+ test_region = get_random_region_with_caps (
461+ required_capabilities = ["Linodes" , "Kubernetes" ]
462+ )
463+ lke_version = exec_test_command (
464+ BASE_CMDS ["lke" ]
465+ + [
466+ "versions-list" ,
467+ "--text" ,
468+ "--no-headers" ,
469+ ]
470+ ).splitlines ()[0 ]
471+
472+ # Create cluster with apl_enabled=false
473+ cluster_label = exec_test_command (
474+ BASE_CMDS ["lke" ]
475+ + [
476+ "cluster-create" ,
477+ "--region" ,
478+ test_region ,
479+ "--label" ,
480+ label ,
481+ "--node_pools.type" ,
482+ "g6-standard-1" ,
483+ "--node_pools.count" ,
484+ "1" ,
485+ "--node_pools.disks" ,
486+ '[{"type":"ext4","size":1024}]' ,
487+ "--k8s_version" ,
488+ lke_version ,
489+ "--tier" ,
490+ "standard" ,
491+ "--apl_enabled" ,
492+ "false" ,
493+ "--text" ,
494+ "--delimiter" ,
495+ "," ,
496+ "--no-headers" ,
497+ "--format=label" ,
498+ ]
499+ )
500+
501+ assert label == cluster_label
502+
503+ cluster_id = get_cluster_id (label = cluster_label )
504+
505+ # Verify apl_enabled is set to false
506+ res = exec_test_command (
507+ BASE_CMDS ["lke" ] + ["cluster-view" , cluster_id , "--json" ]
508+ )
509+ cluster_data = json .loads (res )
510+ assert cluster_data [0 ]["apl_enabled" ] is False
511+
512+ delete_target_id (
513+ target = "lke" , id = cluster_id , delete_command = "cluster-delete"
514+ )
515+
516+
517+ def test_create_cluster_apl_default (monkeypatch ):
518+ """
519+ Test creating an LKE cluster without specifying apl_enabled (should default to false).
520+ """
521+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
522+
523+ label = get_random_text (8 ) + "_apl_default_cluster"
524+
525+ test_region = get_random_region_with_caps (
526+ required_capabilities = ["Linodes" , "Kubernetes" ]
527+ )
528+ lke_version = exec_test_command (
529+ BASE_CMDS ["lke" ]
530+ + [
531+ "versions-list" ,
532+ "--text" ,
533+ "--no-headers" ,
534+ ]
535+ ).splitlines ()[0 ]
536+
537+ # Create cluster without apl_enabled parameter
538+ cluster_label = exec_test_command (
539+ BASE_CMDS ["lke" ]
540+ + [
541+ "cluster-create" ,
542+ "--region" ,
543+ test_region ,
544+ "--label" ,
545+ label ,
546+ "--node_pools.type" ,
547+ "g6-standard-1" ,
548+ "--node_pools.count" ,
549+ "1" ,
550+ "--node_pools.disks" ,
551+ '[{"type":"ext4","size":1024}]' ,
552+ "--k8s_version" ,
553+ lke_version ,
554+ "--tier" ,
555+ "standard" ,
556+ "--text" ,
557+ "--delimiter" ,
558+ "," ,
559+ "--no-headers" ,
560+ "--format=label" ,
561+ ]
562+ )
563+
564+ assert label == cluster_label
565+
566+ cluster_id = get_cluster_id (label = cluster_label )
567+
568+ # Verify apl_enabled defaults to false
569+ res = exec_test_command (
570+ BASE_CMDS ["lke" ] + ["cluster-view" , cluster_id , "--json" ]
571+ )
572+ cluster_data = json .loads (res )
573+ assert cluster_data [0 ]["apl_enabled" ] is False
574+
575+ delete_target_id (
576+ target = "lke" , id = cluster_id , delete_command = "cluster-delete"
577+ )
578+
579+
580+ def test_list_clusters_includes_apl_enabled (monkeypatch ):
581+ """
582+ Test that clusters-list includes apl_enabled field for all clusters.
583+ """
584+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
585+
586+ # Create two clusters - one with APL enabled, one without
587+ label_apl_on = get_random_text (8 ) + "_apl_on"
588+ label_apl_off = get_random_text (8 ) + "_apl_off"
589+
590+ test_region = get_random_region_with_caps (
591+ required_capabilities = ["Linodes" , "Kubernetes" ]
592+ )
593+ lke_version = exec_test_command (
594+ BASE_CMDS ["lke" ]
595+ + [
596+ "versions-list" ,
597+ "--text" ,
598+ "--no-headers" ,
599+ ]
600+ ).splitlines ()[0 ]
601+
602+ # Create cluster with APL enabled
603+ exec_test_command (
604+ BASE_CMDS ["lke" ]
605+ + [
606+ "cluster-create" ,
607+ "--region" ,
608+ test_region ,
609+ "--label" ,
610+ label_apl_on ,
611+ "--node_pools.type" ,
612+ "g6-dedicated-8" ,
613+ "--node_pools.count" ,
614+ "3" ,
615+ "--node_pools.disks" ,
616+ '[{"type":"ext4","size":1024}]' ,
617+ "--k8s_version" ,
618+ lke_version ,
619+ "--tier" ,
620+ "standard" ,
621+ "--apl_enabled" ,
622+ "true" ,
623+ "--text" ,
624+ "--no-headers" ,
625+ "--format=label" ,
626+ ]
627+ )
628+
629+ # Create cluster with APL disabled
630+ exec_test_command (
631+ BASE_CMDS ["lke" ]
632+ + [
633+ "cluster-create" ,
634+ "--region" ,
635+ test_region ,
636+ "--label" ,
637+ label_apl_off ,
638+ "--node_pools.type" ,
639+ "g6-standard-1" ,
640+ "--node_pools.count" ,
641+ "1" ,
642+ "--node_pools.disks" ,
643+ '[{"type":"ext4","size":1024}]' ,
644+ "--k8s_version" ,
645+ lke_version ,
646+ "--tier" ,
647+ "standard" ,
648+ "--apl_enabled" ,
649+ "false" ,
650+ "--text" ,
651+ "--no-headers" ,
652+ "--format=label" ,
653+ ]
654+ )
655+
656+ cluster_id_apl_on = get_cluster_id (label = label_apl_on )
657+ cluster_id_apl_off = get_cluster_id (label = label_apl_off )
658+
659+ # List all clusters and verify apl_enabled is present
660+ res = exec_test_command (BASE_CMDS ["lke" ] + ["clusters-list" , "--json" ])
661+ clusters = json .loads (res )
662+
663+ # Find our test clusters
664+ apl_on_cluster = next (
665+ (c for c in clusters if c ["id" ] == int (cluster_id_apl_on )), None
666+ )
667+ apl_off_cluster = next (
668+ (c for c in clusters if c ["id" ] == int (cluster_id_apl_off )), None
669+ )
670+
671+ assert apl_on_cluster is not None
672+ assert apl_off_cluster is not None
673+
674+ assert apl_on_cluster ["apl_enabled" ] is True
675+ assert apl_off_cluster ["apl_enabled" ] is False
676+
677+ # Cleanup
678+ delete_target_id (
679+ target = "lke" , id = cluster_id_apl_on , delete_command = "cluster-delete"
680+ )
681+ delete_target_id (
682+ target = "lke" , id = cluster_id_apl_off , delete_command = "cluster-delete"
683+ )
0 commit comments