Skip to content

Commit

Permalink
Do not deploy AKS Billing extension for national clouds (Azure#3417)
Browse files Browse the repository at this point in the history
* Add UseAksExtension condition

* Add UseAksExtension config

* Remove UseAksExtension from autoscaler

* Auto disable AKS extension for national clouds
  • Loading branch information
gsacavdm authored and julienstroheker committed Jul 16, 2018
1 parent 1ce3e3d commit e8edae8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
6 changes: 4 additions & 2 deletions parts/k8s/kubernetesagentresourcesvmas.t
Original file line number Diff line number Diff line change
Expand Up @@ -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')]",
Expand All @@ -346,4 +347,5 @@
}
}
}
{{end}}

6 changes: 4 additions & 2 deletions parts/k8s/kubernetesagentresourcesvmss.t
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -157,6 +158,7 @@
"settings": {}
}
}
{{end}}
{{if UseManagedIdentity}}
,{
"name": "managedIdentityExtension",
Expand Down
9 changes: 6 additions & 3 deletions parts/k8s/kubernetesmasterresources.t
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,9 @@
{{end}}
}
}
},
{
}
{{if UseAksExtension}}
,{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('masterVMNamePrefix'), copyIndex(variables('masterOffset')), '/computeAksLinuxBilling')]",
"apiVersion": "[variables('apiVersionDefault')]",
Expand All @@ -925,4 +926,6 @@
"settings": {
}
}
}{{WriteLinkedTemplatesForExtensions}}
}
{{end}}
{{WriteLinkedTemplatesForExtensions}}
8 changes: 5 additions & 3 deletions parts/k8s/kuberneteswinagentresourcesvmas.t
Original file line number Diff line number Diff line change
Expand Up @@ -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')]",
Expand All @@ -295,4 +296,5 @@
"settings": {
}
}
}
}
{{end}}
6 changes: 4 additions & 2 deletions parts/k8s/kuberneteswinagentresourcesvmss.t
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -125,6 +126,7 @@
"settings": {}
}
}
{{end}}
{{if UseManagedIdentity}}
,{
"name": "managedIdentityExtension",
Expand Down
4 changes: 4 additions & 0 deletions pkg/acsengine/template_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down

0 comments on commit e8edae8

Please sign in to comment.