-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathscenario_test.go
More file actions
2915 lines (2775 loc) · 123 KB
/
scenario_test.go
File metadata and controls
2915 lines (2775 loc) · 123 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package e2e
import (
"context"
"fmt"
"testing"
"time"
aksnodeconfigv1 "github.com/Azure/agentbaker/aks-node-controller/pkg/gen/aksnodeconfig/v1"
"github.com/Azure/agentbaker/e2e/components"
"github.com/Azure/agentbaker/e2e/config"
"github.com/Azure/agentbaker/e2e/toolkit"
"github.com/Azure/agentbaker/pkg/agent/datamodel"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v8"
"github.com/stretchr/testify/require"
)
func Test_AzureLinux3OSGuard(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using an Azure Linux V3 OS Guard VHD can be properly bootstrapped",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDAzureLinux3OSGuard,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.AgentPoolProfile.LocalDNSProfile = nil
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateFIPSProvider(ctx, s)
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
},
})
}
func Test_Flatcar(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using a Flatcar VHD can be properly bootstrapped and custom CA was correctly added",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDFlatcarGen2,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.CustomCATrustConfig = &datamodel.CustomCATrustConfig{
CustomCATrustCerts: []string{
encodedTestCert,
},
}
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/etc/protocols", "protocols definition file")
ValidateFileIsRegularFile(ctx, s, "/etc/ssl/certs/ca-certificates.crt")
ValidateNonEmptyDirectory(ctx, s, "/opt/certs")
// openssl x509 -hash of input cert
ValidateFileExists(ctx, s, "/etc/ssl/certs/5c3b39ed.0")
},
},
})
}
func Test_Flatcar_Scriptless(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using a Flatcar and the self-contained installer can be properly bootstrapped",
Tags: Tags{
Scriptless: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDFlatcarGen2,
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/var/log/azure/aks-node-controller.log", "aks-node-controller finished successfully")
},
AKSNodeConfigMutator: func(_ *Cluster, config *aksnodeconfigv1.Configuration) {
},
},
})
}
func Test_Flatcar_ARM64(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using a Flatcar VHD on ARM64 architecture can be properly bootstrapped",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDFlatcarGen2Arm64,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.AgentPoolProfile.VMSize = "Standard_D2pds_V5"
nbc.IsARM64 = true
},
Validator: func(ctx context.Context, s *Scenario) {
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.SKU.Name = to.Ptr("Standard_D2pds_V5")
},
},
})
}
func Test_AzureLinuxV3_ARM64(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using a AzureLinuxV3 VHD on ARM64 architecture can be properly bootstrapped",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDAzureLinuxV3Gen2Arm64,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.AgentPoolProfile.VMSize = "Standard_D2pds_V5"
nbc.IsARM64 = true
},
Validator: func(ctx context.Context, s *Scenario) {
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.SKU.Name = to.Ptr("Standard_D2pds_V5")
},
},
})
}
func Test_Flatcar_AzureCNI(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Flatcar scenario on a cluster configured with Azure CNI and the chrony service restarts if it is killed",
Config: Config{
Cluster: ClusterAzureNetwork,
VHD: config.VHDFlatcarGen2,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.ContainerService.Properties.OrchestratorProfile.KubernetesConfig.NetworkPlugin = string(armcontainerservice.NetworkPluginAzure)
nbc.AgentPoolProfile.KubernetesConfig.NetworkPlugin = string(armcontainerservice.NetworkPluginAzure)
},
Validator: func(ctx context.Context, s *Scenario) {
ServiceCanRestartValidator(ctx, s, "chronyd", 10)
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "Restart=always")
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "RestartSec=5")
},
},
})
}
func Test_Ubuntu2204_AzureCNI(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Ubuntu 22.04 scenario on a cluster configured with Azure CNI",
Config: Config{
Cluster: clusterAzureOverlayNetwork,
VHD: config.VHDUbuntu2204Gen2Containerd,
BootstrapConfigMutator: func(c *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.ContainerService.Properties.OrchestratorProfile.KubernetesConfig.NetworkPlugin = string(armcontainerservice.NetworkPluginNone)
nbc.AgentPoolProfile.KubernetesConfig.NetworkPlugin = string(armcontainerservice.NetworkPluginNone)
nbc.AgentPoolProfile.CustomNodeLabels["kubernetes.azure.com/podnetwork-type"] = "overlay"
nbc.AgentPoolProfile.CustomNodeLabels["kubernetes.azure.com/nodenetwork-vnetguid"] = c.VNetResourceGUID
},
Validator: func(ctx context.Context, s *Scenario) {
},
},
})
}
func Test_Flatcar_AzureCNI_ChronyRestarts_Scriptless(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Test Flatcar scenario on a cluster configured with Azure CNI and the chrony service restarts if it is killed",
Tags: Tags{
Scriptless: true,
},
Config: Config{
Cluster: ClusterAzureNetwork,
VHD: config.VHDFlatcarGen2,
AKSNodeConfigMutator: func(_ *Cluster, config *aksnodeconfigv1.Configuration) {
config.NetworkConfig.NetworkPlugin = aksnodeconfigv1.NetworkPlugin_NETWORK_PLUGIN_AZURE
},
Validator: func(ctx context.Context, s *Scenario) {
ServiceCanRestartValidator(ctx, s, "chronyd", 10)
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "Restart=always")
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "RestartSec=5")
},
},
})
}
func Test_Flatcar_SecureTLSBootstrapping_BootstrapToken_Fallback(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using a Flatcar Gen2 VHD can be properly bootstrapped even if secure TLS bootstrapping fails",
Tags: Tags{
BootstrapTokenFallback: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDFlatcarGen2,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.SecureTLSBootstrappingConfig = &datamodel.SecureTLSBootstrappingConfig{
Enabled: true,
Deadline: (10 * time.Second).String(),
UserAssignedIdentityID: "invalid", // use an unexpected user-assigned identity ID to force a secure TLS bootstrapping failure
}
},
},
})
}
func Test_ACL(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using an ACL VHD can be properly bootstrapped and custom CA was correctly added",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDACLGen2TL,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.CustomCATrustConfig = &datamodel.CustomCATrustConfig{
CustomCATrustCerts: []string{
encodedTestCert,
},
}
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/etc/os-release", "ID=azurelinux")
ValidateFileHasContent(ctx, s, "/etc/os-release", "VARIANT_ID=azurecontainerlinux")
ValidateFileExists(ctx, s, "/etc/ssl/certs/ca-certificates.crt")
// ACL uses Azure Linux CA trust paths under /etc (read-only /usr via dm-verity)
ValidateNonEmptyDirectory(ctx, s, "/etc/pki/ca-trust/source/anchors")
},
},
})
}
func Test_ACL_ARM64(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using an ACL VHD on ARM64 architecture can be properly bootstrapped",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDACLArm64Gen2TL,
// v6 (Cobalt 100) only supports NVMe disk controllers, not ResourceDisk
UseNVMe: true,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
// Ampere Altra (v5) doesn't support TrustedLaunch; Cobalt 100 (v6) does
nbc.AgentPoolProfile.VMSize = "Standard_D2pds_v6"
nbc.IsARM64 = true
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
vmss.SKU.Name = to.Ptr("Standard_D2pds_v6")
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/etc/os-release", "ID=azurelinux")
ValidateFileHasContent(ctx, s, "/etc/os-release", "VARIANT_ID=azurecontainerlinux")
ValidateFileExists(ctx, s, "/etc/ssl/certs/ca-certificates.crt")
},
},
})
}
func Test_ACLGen2FIPSTL(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using the ACL FIPS TrustedLaunch Gen2 VHD can be properly bootstrapped and FIPS is active at runtime",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDACLGen2FIPSTL,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
// LocalDNS isn't currently supported on FIPS-enabled VHDs; mirror Test_AzureLinux3OSGuard.
nbc.AgentPoolProfile.LocalDNSProfile = nil
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/etc/os-release", "ID=azurelinux")
ValidateFileHasContent(ctx, s, "/etc/os-release", "VARIANT_ID=azurecontainerlinux")
ValidateACLFIPSEnabled(ctx, s)
ValidateFIPSProvider(ctx, s)
},
},
})
}
func Test_AzureLinuxV3Gen2FIPS(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using the Azure Linux V3 Gen2 FIPS VHD can be properly bootstrapped and FIPS is active at runtime",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDAzureLinuxV3Gen2FIPS,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
// LocalDNS isn't currently supported on FIPS-enabled VHDs.
nbc.AgentPoolProfile.LocalDNSProfile = nil
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties.AdditionalCapabilities = &armcompute.AdditionalCapabilities{
EnableFips1403Encryption: to.Ptr(true),
}
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateFIPSProvider(ctx, s)
},
},
})
}
func Test_ACL_Scriptless(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using ACL and the self-contained installer can be properly bootstrapped",
Tags: Tags{
Scriptless: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDACLGen2TL,
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/var/log/azure/aks-node-controller.log", "aks-node-controller finished successfully")
},
AKSNodeConfigMutator: func(_ *Cluster, config *aksnodeconfigv1.Configuration) {
},
},
})
}
func Test_ACL_AzureCNI(t *testing.T) {
RunScenario(t, &Scenario{
Description: "ACL scenario on a cluster configured with Azure CNI and the chrony service restarts if it is killed",
Config: Config{
Cluster: ClusterAzureNetwork,
VHD: config.VHDACLGen2TL,
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.ContainerService.Properties.OrchestratorProfile.KubernetesConfig.NetworkPlugin = string(armcontainerservice.NetworkPluginAzure)
nbc.AgentPoolProfile.KubernetesConfig.NetworkPlugin = string(armcontainerservice.NetworkPluginAzure)
},
Validator: func(ctx context.Context, s *Scenario) {
ServiceCanRestartValidator(ctx, s, "chronyd", 10)
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "Restart=always")
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "RestartSec=5")
},
},
})
}
func Test_ACL_SecureTLSBootstrapping_BootstrapToken_Fallback(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using an ACL VHD can be properly bootstrapped even if secure TLS bootstrapping fails",
Tags: Tags{
BootstrapTokenFallback: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDACLGen2TL,
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.SecureTLSBootstrappingConfig = &datamodel.SecureTLSBootstrappingConfig{
Enabled: true,
Deadline: (10 * time.Second).String(),
UserAssignedIdentityID: "invalid", // use an unexpected user-assigned identity ID to force a secure TLS bootstrapping failure
}
},
},
})
}
func Test_ACL_AzureCNI_ChronyRestarts_Scriptless(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Test ACL scenario on a cluster configured with Azure CNI and the chrony service restarts if it is killed",
Tags: Tags{
Scriptless: true,
},
Config: Config{
Cluster: ClusterAzureNetwork,
VHD: config.VHDACLGen2TL,
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
AKSNodeConfigMutator: func(_ *Cluster, config *aksnodeconfigv1.Configuration) {
config.NetworkConfig.NetworkPlugin = aksnodeconfigv1.NetworkPlugin_NETWORK_PLUGIN_AZURE
},
Validator: func(ctx context.Context, s *Scenario) {
ServiceCanRestartValidator(ctx, s, "chronyd", 10)
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "Restart=always")
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "RestartSec=5")
},
},
})
}
func Test_ACL_DisableSSH(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using ACL VHD with SSH disabled can be properly bootstrapped and SSH daemon is disabled",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDACLGen2TL,
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.SSHStatus = datamodel.SSHOff
},
SkipSSHConnectivityValidation: true, // Skip SSH connectivity validation since SSH is down
SkipDefaultValidation: true, // Skip default validation since it requires SSH connectivity
Validator: func(ctx context.Context, s *Scenario) {
// Validate SSH daemon is disabled via RunCommand
ValidateSSHServiceDisabled(ctx, s)
},
},
})
}
func Test_ACL_GPUNC(t *testing.T) {
runScenarioACLGPU(t, "Standard_NC6s_v3", config.Config.DefaultLocation)
}
func Test_ACL_GPUA100(t *testing.T) {
runScenarioACLGPU(t, "Standard_NC24ads_A100_v4", "westus2")
}
func Test_ACL_GPUA10(t *testing.T) {
runScenarioACLGRID(t, "Standard_NV6ads_A10_v5")
}
func runScenarioACLGPU(t *testing.T, vmSize string, location string) {
RunScenario(t, &Scenario{
Description: fmt.Sprintf("Tests that a GPU-enabled node with VM size %s using an ACL VHD", vmSize),
Location: location,
Tags: Tags{
GPU: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDACLGen2TL,
SkipScriptlessNBC: true,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.AgentPoolProfile.VMSize = vmSize
nbc.ConfigGPUDriverIfNeeded = true
nbc.EnableGPUDevicePluginIfNeeded = false
nbc.EnableNvidia = true
nbc.EnableScriptlessCSECmd = true
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.SKU.Name = to.Ptr(vmSize)
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateNvidiaModProbeInstalled(ctx, s)
ValidateNvidiaPersistencedRunning(ctx, s)
ValidateScriptlessCSECmd(ctx, s)
},
},
})
}
func runScenarioACLGRID(t *testing.T, vmSize string) {
RunScenario(t, &Scenario{
Description: fmt.Sprintf("Tests that a GPU-enabled node with VM size %s using an ACL VHD, and that the GRID license is valid", vmSize),
Tags: Tags{
GPU: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDACLGen2TL,
SkipScriptlessNBC: true,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.AgentPoolProfile.VMSize = vmSize
nbc.ConfigGPUDriverIfNeeded = true
nbc.EnableGPUDevicePluginIfNeeded = false
nbc.EnableNvidia = true
nbc.EnableScriptlessCSECmd = true
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.SKU.Name = to.Ptr(vmSize)
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateNvidiaModProbeInstalled(ctx, s)
ValidateNvidiaGRIDLicenseValid(ctx, s)
ValidateNvidiaPersistencedRunning(ctx, s)
ValidateScriptlessCSECmd(ctx, s)
},
},
})
}
func Test_AzureLinuxV3_SecureTLSBootstrapping_BootstrapToken_Fallback(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using a AzureLinuxV3 Gen2 VHD can be properly bootstrapped even if secure TLS bootstrapping fails",
Tags: Tags{
BootstrapTokenFallback: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDAzureLinuxV3Gen2,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.SecureTLSBootstrappingConfig = &datamodel.SecureTLSBootstrappingConfig{
Enabled: true,
Deadline: (10 * time.Second).String(),
UserAssignedIdentityID: "invalid", // use an unexpected user-assigned identity ID to force a secure TLS bootstrapping failure
}
},
},
})
}
func Test_AzureLinuxV3_AzureCNI(t *testing.T) {
RunScenario(t, &Scenario{
Description: "azurelinuxv3 scenario on a cluster configured with Azure CNI",
Tags: Tags{
VMSeriesCoverageTest: true,
},
Config: Config{
Cluster: ClusterAzureNetwork,
VHD: config.VHDAzureLinuxV3Gen2,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.ContainerService.Properties.OrchestratorProfile.KubernetesConfig.NetworkPlugin = string(armcontainerservice.NetworkPluginAzure)
nbc.AgentPoolProfile.KubernetesConfig.NetworkPlugin = string(armcontainerservice.NetworkPluginAzure)
},
},
})
}
func Test_AzureLinuxV3(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that an AzureLinuxV3 node can be properly bootstrapped with message of the day and custom CA trust configured, while chrony restarts and AppArmor remains enabled",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDAzureLinuxV3Gen2,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.AgentPoolProfile.MessageOfTheDay = "Zm9vYmFyDQo=" // base64 for foobar
nbc.CustomCATrustConfig = &datamodel.CustomCATrustConfig{
CustomCATrustCerts: []string{
encodedTestCert,
},
}
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/etc/motd", "foobar")
ValidateFileHasContent(ctx, s, "/etc/dnf/automatic.conf", "emit_via = stdio")
ValidateNonEmptyDirectory(ctx, s, "/usr/share/pki/ca-trust-source/anchors")
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "Restart=always")
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "RestartSec=5")
ServiceCanRestartValidator(ctx, s, "chronyd", 10)
ValidateAppArmorBasic(ctx, s)
},
},
})
}
// Returns config for the 'base' E2E scenario
func Test_Ubuntu2204_Scriptless(t *testing.T) {
customSysctls := map[string]string{
"net.ipv4.ip_local_port_range": "32768 65535",
"net.netfilter.nf_conntrack_max": "2097152",
"net.netfilter.nf_conntrack_buckets": "524288",
"net.ipv4.tcp_keepalive_intvl": "90",
"net.ipv4.ip_local_reserved_ports": "65330",
}
customContainerdUlimits := map[string]string{
"LimitMEMLOCK": "75000",
"LimitNOFILE": "1048",
}
registerWithTaints := "testkey1=value1:NoSchedule,testkey2=value2:NoSchedule"
RunScenario(t, &Scenario{
Description: "tests that a new ubuntu 2204 node using self contained installer can be properly bootstrapped with custom CA trust, custom sysctls, and chrony/taints configured",
Tags: Tags{
Scriptless: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2Containerd,
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/var/log/azure/aks-node-controller.log", "aks-node-controller finished successfully")
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "Restart=always")
ValidateFileHasContent(ctx, s, "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf", "RestartSec=5")
ServiceCanRestartValidator(ctx, s, "chronyd", 10)
ValidateTaints(ctx, s, s.Runtime.AKSNodeConfig.KubeletConfig.KubeletFlags["--register-with-taints"])
ValidateNonEmptyDirectory(ctx, s, "/usr/local/share/ca-certificates/certs")
ValidateUlimitSettings(ctx, s, customContainerdUlimits)
ValidateSysctlConfig(ctx, s, customSysctls)
},
AKSNodeConfigMutator: func(_ *Cluster, config *aksnodeconfigv1.Configuration) {
config.KubeletConfig.KubeletFlags["--register-with-taints"] = registerWithTaints
config.CustomCaCerts = []string{encodedTestCert}
customLinuxOsConfig := &aksnodeconfigv1.CustomLinuxOsConfig{
SysctlConfig: &aksnodeconfigv1.SysctlConfig{
NetNetfilterNfConntrackMax: to.Ptr(toolkit.StrToInt32(customSysctls["net.netfilter.nf_conntrack_max"])),
NetNetfilterNfConntrackBuckets: to.Ptr(toolkit.StrToInt32(customSysctls["net.netfilter.nf_conntrack_buckets"])),
NetIpv4IpLocalPortRange: to.Ptr(customSysctls["net.ipv4.ip_local_port_range"]),
NetIpv4TcpkeepaliveIntvl: to.Ptr(toolkit.StrToInt32(customSysctls["net.ipv4.tcp_keepalive_intvl"])),
},
UlimitConfig: &aksnodeconfigv1.UlimitConfig{
MaxLockedMemory: to.Ptr(customContainerdUlimits["LimitMEMLOCK"]),
NoFile: to.Ptr(customContainerdUlimits["LimitNOFILE"]),
},
}
config.CustomLinuxOsConfig = customLinuxOsConfig
},
},
})
}
func Test_Ubuntu2204_Failure_Scriptless(t *testing.T) {
RunScenario(t, &Scenario{
Description: "tests that a new ubuntu 2204 node using self contained installer can be properly bootstrapped",
Tags: Tags{
Scriptless: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2Containerd,
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileExists(ctx, s, "/opt/azure/containers/provision.complete")
ValidateFileExists(ctx, s, "/var/log/azure/aks/provision.json")
},
AKSNodeConfigMutator: func(_ *Cluster, config *aksnodeconfigv1.Configuration) {
// Intentionally causing a failure here
//config.Version = "v200"
config.BootstrappingConfig = nil
config.KubernetesCaCert = ""
},
ExpectedError: "API server connection check code: 51",
},
})
}
func Test_Ubuntu2204_Early_Failure_Scriptless(t *testing.T) {
RunScenario(t, &Scenario{
Description: "tests that a new ubuntu 2204 node using self contained installer can be properly bootstrapped",
Tags: Tags{
Scriptless: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2Containerd,
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileExists(ctx, s, "/opt/azure/containers/provision.complete")
ValidateFileExists(ctx, s, "/var/log/azure/aks/provision.json")
},
AKSNodeConfigMutator: func(_ *Cluster, config *aksnodeconfigv1.Configuration) {
// Intentionally causing a failure here
config.Version = "VeryBadVersion"
},
ExpectedError: "unsupported version: VeryBadVersion",
},
})
}
func Test_Ubuntu2404_Scriptless(t *testing.T) {
RunScenario(t, &Scenario{
Description: "testing that a new ubuntu 2404 node using self contained installer can be properly bootstrapped",
Tags: Tags{
Scriptless: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2404Gen2Containerd,
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/var/log/azure/aks-node-controller.log", "aks-node-controller finished successfully")
},
AKSNodeConfigMutator: func(_ *Cluster, config *aksnodeconfigv1.Configuration) {
},
},
})
}
// Test_Ubuntu2204_ScriptlessCSECmd_Hotfix tests the EnableScriptlessCSECmd path in
// nodecustomdata.yml which is the foundation for the hotfix delivery mechanism.
// It injects a unique marker into cloud-init write_files via BootstrapConfigMutator,
// then verifies that marker landed on disk — proving cloud-init write_files delivery works.
func Test_Ubuntu2204_ScriptlessCSECmd_Hotfix(t *testing.T) {
const hotfixMarkerPath = "/opt/azure/containers/e2e-hotfix-marker.txt"
hotfixMarkerContent := fmt.Sprintf("HOTFIX_E2E_MARKER_%d", time.Now().UnixNano())
RunScenario(t, &Scenario{
Description: "tests that a node using EnableScriptlessCSECmd delivers write_files content to disk",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2Containerd,
CustomDataWriteFiles: []CustomDataWriteFile{{
Path: hotfixMarkerPath,
Content: hotfixMarkerContent,
}},
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.EnableScriptlessCSECmd = true
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateFileHasContent(ctx, s, "/opt/azure/containers/scriptless-cse-overrides.txt",
"Executing in scriptless CSE mode")
// This file does NOT exist on any VHD — it can only be present if cloud-init
// processed our write_files entry, proving the hotfix delivery mechanism works.
ValidateFileHasContent(ctx, s, hotfixMarkerPath, hotfixMarkerContent)
},
},
})
}
// Test_Ubuntu2204_ANCHotfix_BinarySelection tests that the wrapper script correctly
// selects a pre-existing hotfix binary over the VHD-baked binary. This validates the
// wrapper's binary selection logic without requiring an actual PMC download.
// A stub script at the hotfix binary path delegates to the real ANC binary.
//
// Note: In the EnableScriptlessCSECmd (non-NBC) path, the wrapper runs at boot and
// performs binary selection, but exits before provisioning because no config/nbc-cmd
// file exists at that point. Provisioning happens later via CSE → provision.sh.
// This test validates the wrapper's selection logic; node readiness (implicit in
// RunScenario) confirms provisioning succeeded via the CSE path.
func Test_Ubuntu2204_ANCHotfix_BinarySelection(t *testing.T) {
RunScenario(t, &Scenario{
Description: "tests that the wrapper selects a pre-seeded hotfix binary",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2Containerd,
CustomDataWriteFiles: []CustomDataWriteFile{
{
// Hotfix JSON — triggers download-hotfix, but a real hotfix install
// should be skipped because this intentionally old version will not
// target the VHD base version. The pre-seeded binary below will still
// be found and selected by the wrapper.
Path: "/opt/azure/containers/aks-node-controller-hotfix.json",
Content: `{"version":"200001.01.1"}`,
},
{
// Pre-seed the hotfix binary path with a stub script that delegates
// to the real VHD-baked ANC binary. This simulates a successful
// hotfix download without needing PMC.
Path: "/opt/azure/containers/aks-node-controller-hotfix",
Permissions: "0755",
Content: "#!/bin/bash\nexec /opt/azure/containers/aks-node-controller \"$@\"",
},
},
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.EnableScriptlessCSECmd = true
},
Validator: func(ctx context.Context, s *Scenario) {
// Wrapper found the pre-seeded hotfix binary and selected it
ValidateJournalctlOutput(ctx, s, "aks-node-controller.service", "Using hotfix binary")
// download-hotfix was triggered by the hotfix JSON
ValidateFileHasContent(ctx, s, "/var/log/azure/aks-node-controller.log",
"aks-node-controller hotfix download finished")
},
},
})
}
// Returns config for the 'gpu' E2E scenario
func Test_Ubuntu2204(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using the Ubuntu 2204 VHD can be properly bootstrapped with message of the day and custom CA trust configured",
Tags: Tags{
VMSeriesCoverageTest: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2Containerd,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
// Check that we don't leak these secrets if they're
// set (which they mostly aren't in these scenarios).
nbc.ContainerService.Properties.CertificateProfile.ClientPrivateKey = "client cert private key"
nbc.ContainerService.Properties.ServicePrincipalProfile.Secret = "SP secret"
nbc.AgentPoolProfile.MessageOfTheDay = "Zm9vYmFyDQo=" // base64 for foobar
nbc.CustomCATrustConfig = &datamodel.CustomCATrustConfig{
CustomCATrustCerts: []string{
encodedTestCert,
},
}
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateInstalledPackageVersion(ctx, s, "moby-containerd", components.GetExpectedPackageVersions("containerd", "ubuntu", "r2204")[0])
ValidateInstalledPackageVersion(ctx, s, "moby-runc", components.GetExpectedPackageVersions("runc", "ubuntu", "r2204")[0])
ValidateInstalledPackageVersion(ctx, s, "blobfuse2", "2.5.3")
ValidateSSHServiceEnabled(ctx, s)
ValidateFileHasContent(ctx, s, "/etc/motd", "foobar")
ValidateFileHasContent(ctx, s, "/etc/update-motd.d/99-aks-custom-motd", "cat /etc/motd")
ValidateNonEmptyDirectory(ctx, s, "/usr/local/share/ca-certificates/certs")
},
},
})
}
func Test_Ubuntu2204FIPS(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using the Ubuntu 2204 FIPS Gen1 VHD can be properly bootstrapped",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204FIPSContainerd,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties.AdditionalCapabilities = &armcompute.AdditionalCapabilities{
EnableFips1403Encryption: to.Ptr(true),
}
settings := vmss.Properties.VirtualMachineProfile.ExtensionProfile.Extensions[0].Properties.ProtectedSettings
vmss.Properties.VirtualMachineProfile.ExtensionProfile.Extensions[0].Properties.Settings = settings
vmss.Properties.VirtualMachineProfile.ExtensionProfile.Extensions[0].Properties.ProtectedSettings = nil
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateInstalledPackageVersion(ctx, s, "moby-containerd", components.GetExpectedPackageVersions("containerd", "ubuntu", "r2204")[0])
ValidateInstalledPackageVersion(ctx, s, "moby-runc", components.GetExpectedPackageVersions("runc", "ubuntu", "r2204")[0])
ValidateSSHServiceEnabled(ctx, s)
ValidateFIPSProvider(ctx, s)
},
},
})
}
func Test_Ubuntu2004FIPS(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using the Ubuntu 2004 FIPS Gen1 VHD can be properly bootstrapped",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2004FIPSContainerd,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateInstalledPackageVersion(ctx, s, "moby-containerd", components.GetExpectedPackageVersions("containerd", "ubuntu", "r2004")[0])
ValidateInstalledPackageVersion(ctx, s, "moby-runc", components.GetExpectedPackageVersions("runc", "ubuntu", "r2004")[0])
ValidateSSHServiceEnabled(ctx, s)
ValidateFIPSProvider(ctx, s)
},
},
})
}
func Test_Ubuntu2204Gen2FIPS(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using the Ubuntu 2204 FIPS Gen2 VHD can be properly bootstrapped",
Tags: Tags{
VMSeriesCoverageTest: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2FIPSContainerd,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties.AdditionalCapabilities = &armcompute.AdditionalCapabilities{
EnableFips1403Encryption: to.Ptr(true),
}
settings := vmss.Properties.VirtualMachineProfile.ExtensionProfile.Extensions[0].Properties.ProtectedSettings
vmss.Properties.VirtualMachineProfile.ExtensionProfile.Extensions[0].Properties.Settings = settings
vmss.Properties.VirtualMachineProfile.ExtensionProfile.Extensions[0].Properties.ProtectedSettings = nil
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateInstalledPackageVersion(ctx, s, "moby-containerd", components.GetExpectedPackageVersions("containerd", "ubuntu", "r2204")[0])
ValidateInstalledPackageVersion(ctx, s, "moby-runc", components.GetExpectedPackageVersions("runc", "ubuntu", "r2204")[0])
ValidateSSHServiceEnabled(ctx, s)
ValidateFIPSProvider(ctx, s)
},
},
})
}
func Test_Ubuntu2204Gen2FIPSTL(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using the Ubuntu 2204 FIPS TrustedLaunch Gen2 VHD can be properly bootstrapped",
Tags: Tags{
VMSeriesCoverageTest: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2FIPSTLContainerd,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
vmss.Properties = addTrustedLaunchToVMSS(vmss.Properties)
vmss.Properties.AdditionalCapabilities = &armcompute.AdditionalCapabilities{
EnableFips1403Encryption: to.Ptr(true),
}
settings := vmss.Properties.VirtualMachineProfile.ExtensionProfile.Extensions[0].Properties.ProtectedSettings
vmss.Properties.VirtualMachineProfile.ExtensionProfile.Extensions[0].Properties.Settings = settings
vmss.Properties.VirtualMachineProfile.ExtensionProfile.Extensions[0].Properties.ProtectedSettings = nil
},
Validator: func(ctx context.Context, s *Scenario) {
ValidateInstalledPackageVersion(ctx, s, "moby-containerd", components.GetExpectedPackageVersions("containerd", "ubuntu", "r2204")[0])
ValidateInstalledPackageVersion(ctx, s, "moby-runc", components.GetExpectedPackageVersions("runc", "ubuntu", "r2204")[0])
ValidateSSHServiceEnabled(ctx, s)
ValidateFIPSProvider(ctx, s)
},
},
})
}
func Test_Ubuntu2204_EntraIDSSH(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using Ubuntu 2204 VHD with Entra ID SSH can be properly bootstrapped and SSH private key authentication is disabled",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2Containerd,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
// Enable Entra ID SSH authentication
nbc.SSHStatus = datamodel.EntraIDSSH
},
SkipSSHConnectivityValidation: true, // Skip SSH connectivity validation since Entra ID SSH disables private key authentication
SkipDefaultValidation: true, // Skip default validation since it requires SSH connectivity
Validator: func(ctx context.Context, s *Scenario) {
// NOTE: Since Entra ID SSH disables pubkey authentication, we cannot use
// the normal SSH-based validation functions that rely on private key authentication.
// We can only validate that SSH private key authentication fails as expected.
// The full E2E of Entra ID SSH scenario will be included in AKS RP's E2E test.
// Validate Entra ID SSH configuration (tests that private key SSH fails)
ValidatePubkeySSHDisabled(ctx, s)
},
},
})
}
func Test_Ubuntu2204_EntraIDSSH_Scriptless(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using Ubuntu 2204 VHD with Entra ID SSH can be properly bootstrapped and SSH private key authentication is disabled",
Tags: Tags{
Scriptless: true,
},
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2Containerd,
AKSNodeConfigMutator: func(_ *Cluster, config *aksnodeconfigv1.Configuration) {
config.DisablePubkeyAuth = to.Ptr(true)
},
SkipSSHConnectivityValidation: true, // Skip SSH connectivity validation since Entra ID SSH disables private key authentication
SkipDefaultValidation: true, // Skip default validation since it requires SSH connectivity
Validator: func(ctx context.Context, s *Scenario) {
// NOTE: Since Entra ID SSH disables pubkey authentication, we cannot use
// the normal SSH-based validation functions that rely on private key authentication.
// We can only validate that SSH private key authentication fails as expected.
// The full E2E of Entra ID SSH scenario will be included in AKS RP's E2E test.
// Validate Entra ID SSH configuration (tests that private key SSH fails)
ValidatePubkeySSHDisabled(ctx, s)
},
},
})
}
func Test_AzureLinuxV3_DisableSSH(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using AzureLinuxV3 VHD with SSH disabled can be properly bootstrapped and SSH daemon is disabled",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDAzureLinuxV3Gen2,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.SSHStatus = datamodel.SSHOff
},
SkipSSHConnectivityValidation: true, // Skip SSH connectivity validation since SSH is down
SkipDefaultValidation: true, // Skip default validation since it requires SSH connectivity
Validator: func(ctx context.Context, s *Scenario) {
// Validate SSH daemon is disabled via RunCommand
ValidateSSHServiceDisabled(ctx, s)
},
},
})
}
func Test_Ubuntu2204_DisableSSH(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using Ubuntu 2204 VHD with SSH disabled can be properly bootstrapped and SSH daemon is disabled",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDUbuntu2204Gen2Containerd,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.SSHStatus = datamodel.SSHOff
},
SkipSSHConnectivityValidation: true, // Skip SSH connectivity validation since SSH is down
SkipDefaultValidation: true, // Skip default validation since it requires SSH connectivity
Validator: func(ctx context.Context, s *Scenario) {
// Validate SSH daemon is disabled via RunCommand
ValidateSSHServiceDisabled(ctx, s)
},
},
})
}
func Test_Flatcar_DisableSSH(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using Flatcar VHD with SSH disabled can be properly bootstrapped and SSH daemon is disabled",
Config: Config{
Cluster: ClusterKubenet,
VHD: config.VHDFlatcarGen2,
BootstrapConfigMutator: func(_ *Cluster, nbc *datamodel.NodeBootstrappingConfiguration) {
nbc.SSHStatus = datamodel.SSHOff
},
SkipSSHConnectivityValidation: true, // Skip SSH connectivity validation since SSH is down
SkipDefaultValidation: true, // Skip default validation since it requires SSH connectivity
Validator: func(ctx context.Context, s *Scenario) {
// Validate SSH daemon is disabled via RunCommand
ValidateSSHServiceDisabled(ctx, s)
},
},
})
}
func Test_Flatcar_NetworkIsolatedCluster_NonAnonymousACR(t *testing.T) {
RunScenario(t, &Scenario{
Description: "Tests that a node using Flatcar VHD with network isolated cluster enabled",
Tags: Tags{
NetworkIsolated: true,
NonAnonymousACR: true,
},
Config: Config{
Cluster: ClusterAzureNetworkIsolated,