Skip to content

Commit

Permalink
Remove azure.json from Windows Agent
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiezhang committed Jul 5, 2017
1 parent c9d0704 commit 639e36a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 41 deletions.
2 changes: 1 addition & 1 deletion parts/kuberneteswinagentresourcesvmas.t
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
"autoUpgradeMinorVersion": true,
"settings": {},
"protectedSettings": {
"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'),' -AzureHostname ',variables('{{.Name}}VMNamePrefix'),copyIndex(variables('{{.Name}}Offset')),' -AADClientId ',variables('servicePrincipalClientId'),' -AADClientSecret ',variables('servicePrincipalClientSecret'),variables('singleQuote'), ' ; ', variables('windowsCustomScriptSuffix'), '\" > %SYSTEMDRIVE%\\AzureData\\CustomDataSetupScript.log 2>&1')]"
"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'),' -AzureHostname ',variables('{{.Name}}VMNamePrefix'),copyIndex(variables('{{.Name}}Offset')),variables('singleQuote'), ' ; ', variables('windowsCustomScriptSuffix'), '\" > %SYSTEMDRIVE%\\AzureData\\CustomDataSetupScript.log 2>&1')]"
}
}
}
42 changes: 4 additions & 38 deletions parts/kuberneteswindowssetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ param(

[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
$AzureHostname,

[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
$AADClientId,

[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
$AADClientSecret
$AzureHostname
)

$global:CACertificate = "{{WrapAsVariable "caCertificate"}}"
Expand Down Expand Up @@ -106,30 +98,6 @@ Patch-WinNATBinary()
}
}

function
Write-AzureConfig()
{
$azureConfigFile = $global:KubeDir + "\azure.json"

$azureConfig = @"
{
"tenantId": "$global:TenantId",
"subscriptionId": "$global:SubscriptionId",
"aadClientId": "$AADClientId",
"aadClientSecret": "$AADClientSecret",
"resourceGroup": "$global:ResourceGroup",
"location": "$Location",
"subnetName": "$global:SubnetName",
"securityGroupName": "$global:SecurityGroupName",
"vnetName": "$global:VNetName",
"routeTableName": "$global:RouteTableName",
"primaryAvailabilitySetName": "$global:PrimaryAvailabilitySetName"
}
"@

$azureConfig | Out-File -encoding ASCII -filepath "$azureConfigFile"
}

function
Write-KubeConfig()
{
Expand Down Expand Up @@ -172,7 +140,7 @@ Write-KubernetesStartFiles($podCIDR)
{
$KubeletArgList = @("--hostname-override=`$global:AzureHostname","--pod-infra-container-image=kubletwin/pause","--resolv-conf=""""""""","--api-servers=https://`${global:MasterIP}:443","--kubeconfig=c:\k\config")
$KubeletCommandLine = @"
c:\k\kubelet.exe --hostname-override=`$global:AzureHostname --pod-infra-container-image=kubletwin/pause --resolv-conf="" --allow-privileged=true --enable-debugging-handlers --api-servers=https://`${global:MasterIP}:443 --cluster-dns=`$global:KubeDnsServiceIp --cluster-domain=cluster.local --kubeconfig=c:\k\config --hairpin-mode=promiscuous-bridge --v=2 --azure-container-registry-config=c:\k\azure.json
c:\k\kubelet.exe --hostname-override=`$global:AzureHostname --pod-infra-container-image=kubletwin/pause --resolv-conf="" --allow-privileged=true --enable-debugging-handlers --api-servers=https://`${global:MasterIP}:443 --cluster-dns=`$global:KubeDnsServiceIp --cluster-domain=cluster.local --kubeconfig=c:\k\config --hairpin-mode=promiscuous-bridge --v=2
"@

if ($global:KubeBinariesVersion -ne "1.5.3" -and $global:KubeBinariesVersion -ne "1.5.7")
Expand Down Expand Up @@ -369,13 +337,11 @@ try
# the output.
if ($true) {
Write-Log "Provisioning $global:DockerServiceName... with IP $MasterIP"
net start Docker

Write-Log "download kubelet binaries and unzip"
Get-KubeBinaries

Write-Log "Write azure config"
Write-AzureConfig

Write-Log "Write kube config"
Write-KubeConfig

Expand Down Expand Up @@ -404,7 +370,7 @@ try
else
{
# keep for debugging purposes
Write-Log ".\CustomDataSetupScript.ps1 -MasterIP $MasterIP -KubeDnsServiceIp $KubeDnsServiceIp -MasterFQDNPrefix $MasterFQDNPrefix -Location $Location -AgentKey $AgentKey -AzureHostname $AzureHostname -AADClientId $AADClientId -AADClientSecret $AADClientSecret"
Write-Log ".\CustomDataSetupScript.ps1 -MasterIP $MasterIP -KubeDnsServiceIp $KubeDnsServiceIp -MasterFQDNPrefix $MasterFQDNPrefix -Location $Location -AgentKey $AgentKey -AzureHostname $AzureHostname"
}
}
catch
Expand Down

0 comments on commit 639e36a

Please sign in to comment.