Skip to content

Commit

Permalink
Merge pull request #285 from ksubrmnn/overlay
Browse files Browse the repository at this point in the history
Update scripts for overlay
  • Loading branch information
madhanrm authored Nov 30, 2018
2 parents e1b7c4f + 077f896 commit 9faa550
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 192 deletions.
72 changes: 36 additions & 36 deletions Kubernetes/flannel/overlay/cni/config/cni.conf
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{
"cniVersion": "0.2.0",
"name": "vxlan0",
"type": "flannel",
"delegate": {
"type": "overlay",
"dns": {
"Nameservers": [
"11.0.0.10"
],
"Search": [
"svc.cluster.local"
]
},
"Policies": [
{
"Name": "EndpointPolicy",
"Value": {
"Type": "OutBoundNAT",
"ExceptionList": [
"192.168.0.0/16",
"11.0.0.0/8"
]
}
},
{
"Name": "EndpointPolicy",
"Value": {
"Type": "ROUTE",
"DestinationPrefix": "11.0.0.0/8",
"NeedEncap": true
}
}
]
}
}
{
"cniVersion": "0.2.0",
"name": "vxlan0",
"type": "flannel",
"delegate": {
"type": "win-overlay",
"dns": {
"Nameservers": [
"11.0.0.10"
],
"Search": [
"default.svc.cluster.local"
]
},
"Policies": [
{
"Name": "EndpointPolicy",
"Value": {
"Type": "OutBoundNAT",
"ExceptionList": [
"192.168.0.0/16",
"11.0.0.0/8"
]
}
},
{
"Name": "EndpointPolicy",
"Value": {
"Type": "ROUTE",
"DestinationPrefix": "11.0.0.0/8",
"NeedEncap": true
}
}
]
}
}
Binary file removed Kubernetes/flannel/overlay/cni/overlay.exe
Binary file not shown.
Binary file added Kubernetes/flannel/overlay/cni/win-overlay.exe
Binary file not shown.
Binary file modified Kubernetes/flannel/overlay/flanneld.exe
Binary file not shown.
16 changes: 8 additions & 8 deletions Kubernetes/flannel/overlay/start-kubelet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Param(

$NetworkMode = "Overlay"
# Todo : Get these values using kubectl
$KubeDnsSuffix ="svc.cluster.local"
$KubeDnsSuffix ="default.svc.cluster.local"
$KubeDnsServiceIp="11.0.0.10"
$serviceCIDR="11.0.0.0/8"

Expand All @@ -24,12 +24,12 @@ Update-CNIConfig($podCIDR)
"name": "<NetworkMode>",
"type": "flannel",
"delegate": {
"type": "overlay",
"type": "win-overlay",
"dns" : {
"Nameservers" : [ "11.0.0.10" ],
"Search": [ "svc.cluster.local" ]
"Search": [ "default.svc.cluster.local" ]
},
"AdditionalArgs" : [
"Policies" : [
{
"Name" : "EndpointPolicy", "Value" : { "Type" : "OutBoundNAT", "ExceptionList": [ "<ClusterCIDR>", "<ServerCIDR>" ] }
},
Expand All @@ -44,14 +44,14 @@ Update-CNIConfig($podCIDR)
$configJson = ConvertFrom-Json $jsonSampleConfig
$configJson.type = "flannel"
$configJson.name = $NetworkName
$configJson.delegate.type = "overlay"
$configJson.delegate.type = "win-overlay"
$configJson.delegate.dns.Nameservers[0] = $KubeDnsServiceIp
$configJson.delegate.dns.Search[0] = $KubeDnsSuffix

$configJson.delegate.AdditionalArgs[0].Value.ExceptionList[0] = $clusterCIDR
$configJson.delegate.AdditionalArgs[0].Value.ExceptionList[1] = $serviceCIDR
$configJson.delegate.Policies[0].Value.ExceptionList[0] = $clusterCIDR
$configJson.delegate.Policies[0].Value.ExceptionList[1] = $serviceCIDR

$configJson.delegate.AdditionalArgs[1].Value.DestinationPrefix = $serviceCIDR
$configJson.delegate.Policies[1].Value.DestinationPrefix = $serviceCIDR

if (Test-Path $CNIConfig) {
Clear-Content -Path $CNIConfig
Expand Down
32 changes: 16 additions & 16 deletions Kubernetes/flannel/overlay/start-kubeproxy.ps1
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Param(
$NetworkName = "vxlan0",
$ManagementIP

)

$env:KUBE_NETWORK=$NetworkName.ToLower()

$sourceVipJSON = Get-Content sourceVip.json | ConvertFrom-Json
$env:SOURCE_VIP= $sourceVipJSON.ip4.ip.Split("/")[0]

$env:HOST_MAC=(Get-NetAdapter -InterfaceAlias (Get-NetIPAddress -IPAddress $ManagementIP).InterfaceAlias).MacAddress

ipmo c:\k\hns.psm1
Get-HnsPolicyList | Remove-HnsPolicyList
c:\k\kube-proxy.exe --v=4 --proxy-mode=kernelspace --hostname-override=$(hostname) --kubeconfig=c:\k\config
Param(
$NetworkName = "vxlan0",
$ManagementIP

)
$networkName = $NetworkName.ToLower()

If((Test-Path c:/k/sourceVip.json)) {
$sourceVipJSON = Get-Content sourceVip.json | ConvertFrom-Json
$sourceVip = $sourceVipJSON.ip4.ip.Split("/")[0]
}

$hostMac=(Get-NetAdapter -InterfaceAlias (Get-NetIPAddress -IPAddress $ManagementIP).InterfaceAlias).MacAddress
ipmo c:\k\hns.psm1
Get-HnsPolicyList | Remove-HnsPolicyList
c:\k\kube-proxy.exe --v=4 --proxy-mode=kernelspace --hostname-override=$(hostname) --kubeconfig=c:\k\config --network-name=$networkName --source-vip=$sourceVip --enable-dsr=false
2 changes: 1 addition & 1 deletion Kubernetes/flannel/overlay/start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function DownloadCniBinaries()
md C:\etc\kube-flannel -ErrorAction Ignore

DownloadFile -Url "https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/overlay/cni/config/cni.conf" -Destination $BaseDir\cni\config\cni.conf
DownloadFile -Url "https://github.com/Microsoft/SDN/raw/master/Kubernetes/flannel/overlay/cni/overlay.exe" -Destination $BaseDir\cni\overlay.exe
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
Expand Down
Loading

0 comments on commit 9faa550

Please sign in to comment.