@@ -1286,14 +1286,14 @@ var _ = Describe("getLinuxNodeCSECommand", func() {
12861286})
12871287
12881288var _ = Describe ("getLinuxNodeBootstrappingPayload" , func () {
1289- It ("should persist nodecustomdata in the scriptless NBC boothook" , func () {
1290- templateGenerator := InitializeTemplateGenerator ()
1289+ newConfig := func (preProvisionOnly bool ) * datamodel.NodeBootstrappingConfiguration {
12911290 agentPoolProfile := & datamodel.AgentPoolProfile {
12921291 Name : "nodepool1" ,
12931292 OSType : datamodel .Linux ,
12941293 Distro : datamodel .AKSUbuntuContainerd2204Gen2 ,
12951294 }
1296- config := & datamodel.NodeBootstrappingConfiguration {
1295+
1296+ return & datamodel.NodeBootstrappingConfiguration {
12971297 ContainerService : & datamodel.ContainerService {
12981298 Location : "eastus" ,
12991299 Properties : & datamodel.Properties {
@@ -1315,7 +1315,13 @@ var _ = Describe("getLinuxNodeBootstrappingPayload", func() {
13151315 K8sComponents : & datamodel.K8sComponents {},
13161316 KubeletConfig : map [string ]string {},
13171317 EnableScriptlessNBCCSECmd : true ,
1318+ PreProvisionOnly : preProvisionOnly ,
13181319 }
1320+ }
1321+
1322+ It ("should persist nodecustomdata in the scriptless NBC boothook" , func () {
1323+ templateGenerator := InitializeTemplateGenerator ()
1324+ config := newConfig (false )
13191325
13201326 payload := templateGenerator .getLinuxNodeBootstrappingPayload (config )
13211327 decodedPayload , err := base64 .StdEncoding .DecodeString (payload )
@@ -1330,6 +1336,62 @@ var _ = Describe("getLinuxNodeBootstrappingPayload", func() {
13301336 Expect (string (decodedPayload )).To (ContainSubstring (encodedNodeCustomData ))
13311337 Expect (string (decodedPayload )).To (ContainSubstring (nbcCmdFilePath ))
13321338 })
1339+
1340+ It ("should fall back to regular custom data when pre-provisioning is enabled" , func () {
1341+ templateGenerator := InitializeTemplateGenerator ()
1342+ config := newConfig (true )
1343+
1344+ payload := templateGenerator .getLinuxNodeBootstrappingPayload (config )
1345+ decodedPayload , err := base64 .StdEncoding .DecodeString (payload )
1346+ Expect (err ).NotTo (HaveOccurred ())
1347+
1348+ decompressedPayload , err := getGzipDecodedValue (decodedPayload )
1349+ Expect (err ).NotTo (HaveOccurred ())
1350+
1351+ expectedCustomData := getCustomDataFromJSON (templateGenerator .getLinuxNodeCustomDataJSONObject (config ))
1352+
1353+ Expect (string (decompressedPayload )).To (Equal (expectedCustomData ))
1354+ Expect (string (decompressedPayload )).NotTo (ContainSubstring (nodeCustomDataPath ))
1355+ Expect (string (decompressedPayload )).NotTo (ContainSubstring (nbcCmdFilePath ))
1356+ })
1357+ })
1358+
1359+ var _ = Describe ("getNodeBootstrappingCmd" , func () {
1360+ It ("should use the regular linux CSE command when pre-provisioning is enabled" , func () {
1361+ templateGenerator := InitializeTemplateGenerator ()
1362+ agentPoolProfile := & datamodel.AgentPoolProfile {
1363+ Name : "nodepool1" ,
1364+ OSType : datamodel .Linux ,
1365+ Distro : datamodel .AKSUbuntuContainerd2204Gen2 ,
1366+ }
1367+ config := & datamodel.NodeBootstrappingConfiguration {
1368+ ContainerService : & datamodel.ContainerService {
1369+ Location : "eastus" ,
1370+ Properties : & datamodel.Properties {
1371+ OrchestratorProfile : & datamodel.OrchestratorProfile {
1372+ OrchestratorVersion : "1.29.0" ,
1373+ OrchestratorType : datamodel .Kubernetes ,
1374+ KubernetesConfig : & datamodel.KubernetesConfig {
1375+ ContainerRuntimeConfig : map [string ]string {},
1376+ },
1377+ },
1378+ HostedMasterProfile : & datamodel.HostedMasterProfile {
1379+ FQDN : "test-cluster.hcp.eastus.azmk8s.io" ,
1380+ },
1381+ AgentPoolProfiles : []* datamodel.AgentPoolProfile {agentPoolProfile },
1382+ },
1383+ },
1384+ AgentPoolProfile : agentPoolProfile ,
1385+ CloudSpecConfig : datamodel .AzurePublicCloudSpecForTest ,
1386+ K8sComponents : & datamodel.K8sComponents {},
1387+ KubeletConfig : map [string ]string {},
1388+ EnableScriptlessNBCCSECmd : true ,
1389+ PreProvisionOnly : true ,
1390+ }
1391+
1392+ Expect (templateGenerator .getNodeBootstrappingCmd (config )).To (Equal (templateGenerator .getLinuxNodeCSECommand (config )))
1393+ Expect (templateGenerator .getNodeBootstrappingCmd (config )).NotTo (Equal ("/opt/azure/containers/aks-node-controller provision-wait" ))
1394+ })
13331395})
13341396
13351397var _ = Describe ("cloudInitToButane" , func () {
0 commit comments