@@ -180,6 +180,175 @@ func Test_Flatcar_SecureTLSBootstrapping_BootstrapToken_Fallback(t *testing.T) {
180180 })
181181}
182182
183+ func Test_ACL (t * testing.T ) {
184+ RunScenario (t , & Scenario {
185+ Description : "Tests that a node using an ACL VHD can be properly bootstrapped" ,
186+ Config : Config {
187+ Cluster : ClusterKubenet ,
188+ VHD : config .VHDACLGen2TL ,
189+ BootstrapConfigMutator : func (nbc * datamodel.NodeBootstrappingConfiguration ) {
190+ },
191+ VMConfigMutator : func (vmss * armcompute.VirtualMachineScaleSet ) {
192+ vmss .Properties = addTrustedLaunchToVMSS (vmss .Properties )
193+ },
194+ Validator : func (ctx context.Context , s * Scenario ) {
195+ ValidateFileHasContent (ctx , s , "/etc/os-release" , "ID=acl" )
196+ ValidateFileExists (ctx , s , "/etc/ssl/certs/ca-certificates.crt" )
197+ },
198+ },
199+ })
200+ }
201+
202+ func Test_ACL_Scriptless (t * testing.T ) {
203+ RunScenario (t , & Scenario {
204+ Description : "Tests that a node using ACL and the self-contained installer can be properly bootstrapped" ,
205+ Config : Config {
206+ Cluster : ClusterKubenet ,
207+ VHD : config .VHDACLGen2TL ,
208+ VMConfigMutator : func (vmss * armcompute.VirtualMachineScaleSet ) {
209+ vmss .Properties = addTrustedLaunchToVMSS (vmss .Properties )
210+ },
211+ Validator : func (ctx context.Context , s * Scenario ) {
212+ ValidateFileHasContent (ctx , s , "/var/log/azure/aks-node-controller.log" , "aks-node-controller finished successfully" )
213+ },
214+ AKSNodeConfigMutator : func (config * aksnodeconfigv1.Configuration ) {
215+ },
216+ },
217+ })
218+ }
219+
220+ func Test_ACL_CustomCATrust (t * testing.T ) {
221+ RunScenario (t , & Scenario {
222+ Description : "Tests that a node using an ACL VHD can be properly bootstrapped and custom CA was correctly added" ,
223+ Config : Config {
224+ Cluster : ClusterKubenet ,
225+ VHD : config .VHDACLGen2TL ,
226+ VMConfigMutator : func (vmss * armcompute.VirtualMachineScaleSet ) {
227+ vmss .Properties = addTrustedLaunchToVMSS (vmss .Properties )
228+ },
229+ BootstrapConfigMutator : func (nbc * datamodel.NodeBootstrappingConfiguration ) {
230+ nbc .CustomCATrustConfig = & datamodel.CustomCATrustConfig {
231+ CustomCATrustCerts : []string {
232+ encodedTestCert ,
233+ },
234+ }
235+ },
236+ Validator : func (ctx context.Context , s * Scenario ) {
237+ // ACL uses Azure Linux CA trust paths under /etc (read-only /usr via dm-verity)
238+ ValidateNonEmptyDirectory (ctx , s , "/etc/pki/ca-trust/source/anchors" )
239+ },
240+ },
241+ })
242+ }
243+
244+ func Test_ACL_AzureCNI (t * testing.T ) {
245+ RunScenario (t , & Scenario {
246+ Description : "ACL scenario on a cluster configured with Azure CNI" ,
247+ Config : Config {
248+ Cluster : ClusterAzureNetwork ,
249+ VHD : config .VHDACLGen2TL ,
250+ VMConfigMutator : func (vmss * armcompute.VirtualMachineScaleSet ) {
251+ vmss .Properties = addTrustedLaunchToVMSS (vmss .Properties )
252+ },
253+ BootstrapConfigMutator : func (nbc * datamodel.NodeBootstrappingConfiguration ) {
254+ nbc .ContainerService .Properties .OrchestratorProfile .KubernetesConfig .NetworkPlugin = string (armcontainerservice .NetworkPluginAzure )
255+ nbc .AgentPoolProfile .KubernetesConfig .NetworkPlugin = string (armcontainerservice .NetworkPluginAzure )
256+ },
257+ },
258+ })
259+ }
260+
261+ func Test_ACL_AzureCNI_ChronyRestarts (t * testing.T ) {
262+ RunScenario (t , & Scenario {
263+ Description : "Test ACL scenario on a cluster configured with Azure CNI and the chrony service restarts if it is killed" ,
264+ Config : Config {
265+ Cluster : ClusterAzureNetwork ,
266+ VHD : config .VHDACLGen2TL ,
267+ VMConfigMutator : func (vmss * armcompute.VirtualMachineScaleSet ) {
268+ vmss .Properties = addTrustedLaunchToVMSS (vmss .Properties )
269+ },
270+ BootstrapConfigMutator : func (nbc * datamodel.NodeBootstrappingConfiguration ) {
271+ nbc .ContainerService .Properties .OrchestratorProfile .KubernetesConfig .NetworkPlugin = string (armcontainerservice .NetworkPluginAzure )
272+ nbc .AgentPoolProfile .KubernetesConfig .NetworkPlugin = string (armcontainerservice .NetworkPluginAzure )
273+ },
274+ Validator : func (ctx context.Context , s * Scenario ) {
275+ ServiceCanRestartValidator (ctx , s , "chronyd" , 10 )
276+ ValidateFileHasContent (ctx , s , "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf" , "Restart=always" )
277+ ValidateFileHasContent (ctx , s , "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf" , "RestartSec=5" )
278+ },
279+ },
280+ })
281+ }
282+
283+ func Test_ACL_SecureTLSBootstrapping_BootstrapToken_Fallback (t * testing.T ) {
284+ RunScenario (t , & Scenario {
285+ Description : "Tests that a node using an ACL VHD can be properly bootstrapped even if secure TLS bootstrapping fails" ,
286+ Tags : Tags {
287+ BootstrapTokenFallback : true ,
288+ },
289+ Config : Config {
290+ Cluster : ClusterKubenet ,
291+ VHD : config .VHDACLGen2TL ,
292+ VMConfigMutator : func (vmss * armcompute.VirtualMachineScaleSet ) {
293+ vmss .Properties = addTrustedLaunchToVMSS (vmss .Properties )
294+ },
295+ BootstrapConfigMutator : func (nbc * datamodel.NodeBootstrappingConfiguration ) {
296+ nbc .SecureTLSBootstrappingConfig = & datamodel.SecureTLSBootstrappingConfig {
297+ Enabled : true ,
298+ Deadline : (10 * time .Second ).String (),
299+ UserAssignedIdentityID : "invalid" , // use an unexpected user-assigned identity ID to force a secure TLS bootstrapping failure
300+ }
301+ },
302+ },
303+ })
304+ }
305+
306+ func Test_ACL_AzureCNI_ChronyRestarts_Scriptless (t * testing.T ) {
307+ RunScenario (t , & Scenario {
308+ Description : "Test ACL scenario on a cluster configured with Azure CNI and the chrony service restarts if it is killed" ,
309+ Tags : Tags {
310+ Scriptless : true ,
311+ },
312+ Config : Config {
313+ Cluster : ClusterAzureNetwork ,
314+ VHD : config .VHDACLGen2TL ,
315+ VMConfigMutator : func (vmss * armcompute.VirtualMachineScaleSet ) {
316+ vmss .Properties = addTrustedLaunchToVMSS (vmss .Properties )
317+ },
318+ AKSNodeConfigMutator : func (config * aksnodeconfigv1.Configuration ) {
319+ config .NetworkConfig .NetworkPlugin = aksnodeconfigv1 .NetworkPlugin_NETWORK_PLUGIN_AZURE
320+ },
321+ Validator : func (ctx context.Context , s * Scenario ) {
322+ ServiceCanRestartValidator (ctx , s , "chronyd" , 10 )
323+ ValidateFileHasContent (ctx , s , "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf" , "Restart=always" )
324+ ValidateFileHasContent (ctx , s , "/etc/systemd/system/chronyd.service.d/10-chrony-restarts.conf" , "RestartSec=5" )
325+ },
326+ },
327+ })
328+ }
329+
330+ func Test_ACL_DisableSSH (t * testing.T ) {
331+ RunScenario (t , & Scenario {
332+ Description : "Tests that a node using ACL VHD with SSH disabled can be properly bootstrapped and SSH daemon is disabled" ,
333+ Config : Config {
334+ Cluster : ClusterKubenet ,
335+ VHD : config .VHDACLGen2TL ,
336+ VMConfigMutator : func (vmss * armcompute.VirtualMachineScaleSet ) {
337+ vmss .Properties = addTrustedLaunchToVMSS (vmss .Properties )
338+ },
339+ BootstrapConfigMutator : func (nbc * datamodel.NodeBootstrappingConfiguration ) {
340+ nbc .SSHStatus = datamodel .SSHOff
341+ },
342+ SkipSSHConnectivityValidation : true , // Skip SSH connectivity validation since SSH is down
343+ SkipDefaultValidation : true , // Skip default validation since it requires SSH connectivity
344+ Validator : func (ctx context.Context , s * Scenario ) {
345+ // Validate SSH daemon is disabled via RunCommand
346+ ValidateSSHServiceDisabled (ctx , s )
347+ },
348+ },
349+ })
350+ }
351+
183352func Test_AzureLinuxV3_SecureTLSBootstrapping_BootstrapToken_Fallback (t * testing.T ) {
184353 RunScenario (t , & Scenario {
185354 Description : "Tests that a node using a AzureLinuxV3 Gen2 VHD can be properly bootstrapped even if secure TLS bootstrapping fails" ,
0 commit comments