diff --git a/parts/k8s/kubernetesagentresourcesvmas.t b/parts/k8s/kubernetesagentresourcesvmas.t index ee939fbf1d..4350b8847e 100644 --- a/parts/k8s/kubernetesagentresourcesvmas.t +++ b/parts/k8s/kubernetesagentresourcesvmas.t @@ -324,8 +324,9 @@ {{end}} } } - }, - { + } + {{if UseAksExtension}} + ,{ "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(variables('{{.Name}}VMNamePrefix'), copyIndex(variables('{{.Name}}Offset')), '/computeAksLinuxBilling')]", "apiVersion": "[variables('apiVersionDefault')]", @@ -346,4 +347,5 @@ } } } + {{end}} diff --git a/parts/k8s/kubernetesagentresourcesvmss.t b/parts/k8s/kubernetesagentresourcesvmss.t index d9264d2437..4d72dbb94b 100644 --- a/parts/k8s/kubernetesagentresourcesvmss.t +++ b/parts/k8s/kubernetesagentresourcesvmss.t @@ -145,8 +145,9 @@ "commandToExecute": "[concat(variables('provisionScriptParametersCommon'),' /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1\"')]" } } - }, - { + } + {{if UseAksExtension}} + ,{ "name": "[concat(variables('{{.Name}}VMNamePrefix'), '-computeAksLinuxBilling')]", "location": "[variables('location')]", "properties": { @@ -157,6 +158,7 @@ "settings": {} } } + {{end}} {{if UseManagedIdentity}} ,{ "name": "managedIdentityExtension", diff --git a/parts/k8s/kubernetesmasterresources.t b/parts/k8s/kubernetesmasterresources.t index 9c8aedb63c..69bc8a0060 100644 --- a/parts/k8s/kubernetesmasterresources.t +++ b/parts/k8s/kubernetesmasterresources.t @@ -904,8 +904,9 @@ {{end}} } } - }, - { + } + {{if UseAksExtension}} + ,{ "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(variables('masterVMNamePrefix'), copyIndex(variables('masterOffset')), '/computeAksLinuxBilling')]", "apiVersion": "[variables('apiVersionDefault')]", @@ -925,4 +926,6 @@ "settings": { } } - }{{WriteLinkedTemplatesForExtensions}} + } + {{end}} + {{WriteLinkedTemplatesForExtensions}} diff --git a/parts/k8s/kuberneteswinagentresourcesvmas.t b/parts/k8s/kuberneteswinagentresourcesvmas.t index 4ae8bbeb97..2003c90a13 100644 --- a/parts/k8s/kuberneteswinagentresourcesvmas.t +++ b/parts/k8s/kuberneteswinagentresourcesvmas.t @@ -274,8 +274,9 @@ "commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -command \"', '$arguments = ', variables('singleQuote'),'-MasterIP ',variables('kubernetesAPIServerIP'),' -KubeDnsServiceIp ',variables('kubeDnsServiceIp'),' -MasterFQDNPrefix ',variables('masterFqdnPrefix'),' -Location ',variables('location'),' -AgentKey ',variables('clientPrivateKey'),' -AADClientId ',variables('servicePrincipalClientId'),' -AADClientSecret ',variables('servicePrincipalClientSecret'),variables('singleQuote'), ' ; ', variables('windowsCustomScriptSuffix'), '\" > %SYSTEMDRIVE%\\AzureData\\CustomDataSetupScript.log 2>&1')]" } } - }, - { + } + {{if UseAksExtension}} + ,{ "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(variables('{{.Name}}VMNamePrefix'), copyIndex(variables('{{.Name}}Offset')), '/computeAksLinuxBilling')]", "apiVersion": "[variables('apiVersionDefault')]", @@ -295,4 +296,5 @@ "settings": { } } - } \ No newline at end of file + } + {{end}} \ No newline at end of file diff --git a/parts/k8s/kuberneteswinagentresourcesvmss.t b/parts/k8s/kuberneteswinagentresourcesvmss.t index 6be6d9e0c1..336ddc717a 100644 --- a/parts/k8s/kuberneteswinagentresourcesvmss.t +++ b/parts/k8s/kuberneteswinagentresourcesvmss.t @@ -113,8 +113,9 @@ "commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -command \"', '$arguments = ', variables('singleQuote'),'-MasterIP ',variables('kubernetesAPIServerIP'),' -KubeDnsServiceIp ',variables('kubeDnsServiceIp'),' -MasterFQDNPrefix ',variables('masterFqdnPrefix'),' -Location ',variables('location'),' -AgentKey ',variables('clientPrivateKey'),' -AADClientId ',variables('servicePrincipalClientId'),' -AADClientSecret ',variables('servicePrincipalClientSecret'),variables('singleQuote'), ' ; ', variables('windowsCustomScriptSuffix'), '\" > %SYSTEMDRIVE%\\AzureData\\CustomDataSetupScript.log 2>&1')]" } } - }, - { + } + {{if UseAksExtension}} + ,{ "name": "[concat(variables('{{.Name}}VMNamePrefix'), '-computeAksLinuxBilling')]", "location": "[variables('location')]", "properties": { @@ -125,6 +126,7 @@ "settings": {} } } + {{end}} {{if UseManagedIdentity}} ,{ "name": "managedIdentityExtension", diff --git a/pkg/acsengine/template_generator.go b/pkg/acsengine/template_generator.go index bc5104d0d0..f3f46b6cab 100644 --- a/pkg/acsengine/template_generator.go +++ b/pkg/acsengine/template_generator.go @@ -284,6 +284,10 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat "UseManagedIdentity": func() bool { return cs.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity }, + "UseAksExtension": func() bool { + cloudSpecConfig := getCloudSpecConfig(cs.Location) + return cloudSpecConfig.CloudName == azurePublicCloud + }, "UseInstanceMetadata": func() bool { return helpers.IsTrueBoolPointer(cs.Properties.OrchestratorProfile.KubernetesConfig.UseInstanceMetadata) },