Skip to content

Commit

Permalink
Cleanup scripts
Browse files Browse the repository at this point in the history
Fix download script
  • Loading branch information
Madhan Raj Mookkandy committed Dec 5, 2018
1 parent 9faa550 commit 82852cf
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 268 deletions.
9 changes: 0 additions & 9 deletions Kubernetes/flannel/l2bridge/start-kubeproxy.ps1

This file was deleted.

4 changes: 3 additions & 1 deletion Kubernetes/flannel/l2bridge/start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ function DownloadWindowsKubernetesScripts()
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/hns.psm1 -Destination $BaseDir\hns.psm1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/InstallImages.ps1 -Destination $BaseDir\InstallImages.ps1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/Dockerfile -Destination $BaseDir\Dockerfile
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/stop.ps1 -Destination $BaseDir\stop.ps1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/stop.ps1 -Destination $BaseDir\stop.ps1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/l2bridge/start-kubelet.ps1 -Destination $BaseDir\start-Kubelet.ps1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/start-kubeproxy.ps1 -Destination $BaseDir\start-Kubeproxy.ps1
}

function DownloadAllFiles()
Expand Down
9 changes: 6 additions & 3 deletions Kubernetes/flannel/overlay/start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ function DownloadCniBinaries()
DownloadFile -Url "https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/overlay/cni/win-overlay.exe" -Destination $BaseDir\cni\win-overlay.exe
DownloadFile -Url "https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/l2bridge/cni/flannel.exe" -Destination $BaseDir\cni\flannel.exe
DownloadFile -Url "https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/l2bridge/cni/host-local.exe" -Destination $BaseDir\cni\host-local.exe
DownloadFile -Url "https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/overlay/net-conf.json" -Destination $BaseDir\net-conf.json
cp $BaseDir\net-conf.json C:\etc\kube-flannel\net-conf.json
if (!(Test-File C:\etc\kube-flannel\net-conf.json))
{
DownloadFile -Url "https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/overlay/net-conf.json" -Destination $BaseDir\net-conf.json
cp $BaseDir\net-conf.json C:\etc\kube-flannel\net-conf.json
}
}

function DownloadWindowsKubernetesScripts()
Expand All @@ -30,7 +33,7 @@ function DownloadWindowsKubernetesScripts()
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/hns.psm1 -Destination $BaseDir\hns.psm1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/InstallImages.ps1 -Destination $BaseDir\InstallImages.ps1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/Dockerfile -Destination $BaseDir\Dockerfile
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/overlay/stop.ps1 -Destination $BaseDir\Stop.ps1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/stop.ps1 -Destination $BaseDir\Stop.ps1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/overlay/start-kubelet.ps1 -Destination $BaseDir\start-Kubelet.ps1
DownloadFile -Url https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/overlay/start-kubeproxy.ps1 -Destination $BaseDir\start-Kubeproxy.ps1
}
Expand Down
4 changes: 0 additions & 4 deletions Kubernetes/flannel/overlay/stop.ps1

This file was deleted.

File renamed without changes.
17 changes: 6 additions & 11 deletions Kubernetes/windows/AddRoutes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@ Param(
[parameter(Mandatory = $true)] [string] $masterIp
)

function
Get-MgmtDefaultGatewayAddress()
{
$na = Get-NetAdapter | ? Name -Like "vEthernet (Ethernet*"
return (Get-NetRoute -InterfaceAlias $na.ifAlias -DestinationPrefix "0.0.0.0/0").NextHop
}

function
Add-RouteToPodCIDR($nicName)
{
while (!$podCIDRs) {
Start-Sleep 5
$podCIDRs=c:\k\kubectl.exe --kubeconfig=c:\k\config get nodes -o=custom-columns=Name:.status.nodeInfo.operatingSystem,PODCidr:.spec.podCIDR --no-headers
$podCIDRs=Get-PodCIDRs
Write-Host "Add-RouteToPodCIDR - available nodes $podCIDRs"
}

Expand All @@ -33,19 +26,21 @@ Add-RouteToPodCIDR($nicName)

$route = get-netroute -InterfaceAlias "$nicName" -DestinationPrefix $cidr -erroraction Ignore
if (!$route) {

new-netroute -InterfaceAlias "$nicName" -DestinationPrefix $cidr -NextHop $cidrGw -Verbose
}
}
}

$endpointName = "cbr0"
$vnicName = "vEthernet ($endpointName)"
$WorkingDir = "c:\k"

ipmo $WorkingDir\helper.psm1

# Add routes to all POD networks on the Bridge endpoint nic
Add-RouteToPodCIDR -nicName $vnicName

$na = Get-NetAdapter | ? Name -Like "vEthernet (Ethernet*"
$na = Get-NetAdapter | ? Name -Like "vEthernet (Ethernet*" | ? Status -EQ Up
if (!$na)
{
Write-Error "Do you have a virtual adapter configured? Couldn't find one!"
Expand All @@ -56,7 +51,7 @@ if (!$na)
Add-RouteToPodCIDR -nicName $na.InterfaceAlias

# Update the route for the POD on current host to be on Link
$podCIDR=c:\k\kubectl.exe --kubeconfig=c:\k\config get nodes/$($(hostname).ToLower()) -o custom-columns=podCidr:.spec.podCIDR --no-headers
$podCIDR=Get-PodCIDR
get-NetRoute -DestinationPrefix $podCIDR -InterfaceAlias $na.InterfaceAlias | Remove-NetRoute -Confirm:$false
new-NetRoute -DestinationPrefix $podCIDR -NextHop 0.0.0.0 -InterfaceAlias $na.InterfaceAlias

Expand Down
2 changes: 1 addition & 1 deletion Kubernetes/windows/debug/startpacketcapture.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Cmd /c """netsh trace start globallevel=6 provider={0c885e0d-6eb6-476c-a048-2457eed3a5c1} provider=Microsoft-Windows-TCPIP level=5 provider={80CE50DE-D264-4581-950D-ABADEEE0D340} provider={D0E4BC17-34C7-43fc-9A72-D89A59D6979A} provider={93f693dc-9163-4dee-af64-d855218af242} provider={564368D6-577B-4af5-AD84-1C54464848E6} scenario=Virtualization provider=Microsoft-Windows-Hyper-V-VfpExt capture=yes provider=microsoft-windows-winnat provider={AE3F6C6D-BF2A-4291-9D07-59E661274EE3} keywords=0xffffffff level=6 provider={9B322459-4AD9-4F81-8EEA-DC77CDD18CA6} keywords=0xffffffff level=6 provider={0c885e0d-6eb6-476c-a048-2457eed3a5c1} level=6 report=disabled tracefile=c:\server.etl overwrite=yes persistent=yes"""
Cmd /c """netsh trace start globallevel=6 provider={0c885e0d-6eb6-476c-a048-2457eed3a5c1} provider=Microsoft-Windows-TCPIP level=5 provider={80CE50DE-D264-4581-950D-ABADEEE0D340} provider={D0E4BC17-34C7-43fc-9A72-D89A59D6979A} provider={93f693dc-9163-4dee-af64-d855218af242} provider={564368D6-577B-4af5-AD84-1C54464848E6} scenario=Virtualization provider=Microsoft-Windows-Hyper-V-VfpExt capture=yes captureMultilayer=yes capturetype=both provider=microsoft-windows-winnat provider={AE3F6C6D-BF2A-4291-9D07-59E661274EE3} keywords=0xffffffff level=6 provider={9B322459-4AD9-4F81-8EEA-DC77CDD18CA6} keywords=0xffffffff level=6 provider={0c885e0d-6eb6-476c-a048-2457eed3a5c1} level=6 report=disabled tracefile=c:\server.etl overwrite=yes persistent=yes"""

Loading

0 comments on commit 82852cf

Please sign in to comment.