Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Fix an issue caused by WinNAT (#520)
Browse files Browse the repository at this point in the history
* Fix an issue caused by WinNAT

* Fix test failure

* Add WinNAT fix to v1.6.0 and v1.6.2

* Update example json to fix test error
  • Loading branch information
JiangtianLi authored Apr 27, 2017
1 parent d21d29a commit d852aba
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 13 deletions.
37 changes: 34 additions & 3 deletions parts/kuberneteswindowssetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ $global:SecurityGroupName = "{{{nsgName}}}"
$global:VNetName = "{{{virtualNetworkName}}}"
$global:RouteTableName = "{{{routeTableName}}}"
$global:PrimaryAvailabilitySetName = "{{{primaryAvailablitySetName}}}"
$global:NeedPatchWinNAT = $false

filter Timestamp {"$(Get-Date -Format o): $_"}

Expand Down Expand Up @@ -89,6 +90,22 @@ Get-KubeBinaries()
Expand-ZIPFile -File $zipfile -Destination C:\
}

function
Patch-WinNATBinary()
{
$winnatcurr = $global:KubeDir + "\winnat.sys"
if (Test-Path $winnatcurr)
{
$global:NeedPatchWinNAT = $true
$winnatsys = "$env:SystemRoot\System32\drivers\winnat.sys"
Stop-Service winnat
takeown /f $winnatsys
icacls $winnatsys /grant "Administrators:(F)"
Copy-Item $winnatcurr $winnatsys
bcdedit /set TESTSIGNING on
}
}

function
Write-AzureConfig()
{
Expand Down Expand Up @@ -292,8 +309,11 @@ New-NSSMService
c:\k\nssm set Kubelet AppRotateOnline 1
c:\k\nssm set Kubelet AppRotateSeconds 86400
c:\k\nssm set Kubelet AppRotateBytes 1048576
net start Kubelet

if ($global:NeedPatchWinNAT -eq $false)
{
net start Kubelet
}

# setup kubeproxy
c:\k\nssm install Kubeproxy C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
c:\k\nssm set Kubeproxy AppDirectory $global:KubeDir
Expand All @@ -311,7 +331,10 @@ New-NSSMService
c:\k\nssm set Kubeproxy AppRotateOnline 1
c:\k\nssm set Kubeproxy AppRotateSeconds 86400
c:\k\nssm set Kubeproxy AppRotateBytes 1048576
net start Kubeproxy
if ($global:NeedPatchWinNAT -eq $false)
{
net start Kubeproxy
}
}

function
Expand Down Expand Up @@ -355,7 +378,15 @@ try
Write-Log "Set Internet Explorer"
Set-Explorer

Write-Log "Patch winnat binary"
Patch-WinNATBinary

Write-Log "Setup Complete"
if ($global:NeedPatchWinNAT -eq $true)
{
Write-Log "Reboot for patching winnat to be effective and start kubelet/kubeproxy service"
Restart-Computer
}
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions pkg/acsengine/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var KubeImages = map[string]map[string]string{
"addonmanager": "kube-addon-manager-amd64:v6.2",
"dnsmasq": "kube-dnsmasq-amd64:1.3",
"pause": "pause-amd64:3.0",
"windowszip": "v1.6.2int.zip",
"windowszip": "v1.6.2intwinnat.zip",
},

"1.6.0": {
Expand All @@ -69,7 +69,7 @@ var KubeImages = map[string]map[string]string{
"addonmanager": "kube-addon-manager-amd64:v6.2",
"dnsmasq": "kube-dnsmasq-amd64:1.3",
"pause": "pause-amd64:3.0",
"windowszip": "v1.6.0int.zip",
"windowszip": "v1.6.0intwinnat.zip",
},

"1.5.3": {
Expand All @@ -82,7 +82,7 @@ var KubeImages = map[string]map[string]string{
"addonmanager": "kube-addon-manager-amd64:v6.2",
"dnsmasq": "kube-dnsmasq-amd64:1.3",
"pause": "pause-amd64:3.0",
"windowszip": "v1.5.3int.zip",
"windowszip": "v1.5.3intwinnat.zip",
},
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/acsengine/templates.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/acsengine/testdata/v20170131/kubernetes_expected.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"value": "10.240.255.5"
},
"kubeBinariesSASURL": {
"value": "https://acs-mirror.azureedge.net/wink8s/v1.6.2int.zip"
"value": "https://acs-mirror.azureedge.net/wink8s/v1.6.2intwinnat.zip"
},
"kubeBinariesVersion": {
"value": "1.6.2"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"value": "10.240.255.5"
},
"kubeBinariesSASURL": {
"value": "https://acs-mirror.azureedge.net/wink8s/v1.6.2int.zip"
"value": "https://acs-mirror.azureedge.net/wink8s/v1.6.2intwinnat.zip"
},
"kubeBinariesVersion": {
"value": "1.6.2"
Expand Down
2 changes: 1 addition & 1 deletion pkg/acsengine/testdata/windows/kubernetes_expected.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"value": "10.240.255.5"
},
"kubeBinariesSASURL": {
"value": "https://acs-mirror.azureedge.net/wink8s/v1.6.2int.zip"
"value": "https://acs-mirror.azureedge.net/wink8s/v1.6.2intwinnat.zip"
},
"kubeBinariesVersion": {
"value": "1.6.2"
Expand Down

0 comments on commit d852aba

Please sign in to comment.