-
Notifications
You must be signed in to change notification settings - Fork 260
Dualstack Overlay CNI #1866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Dualstack Overlay CNI #1866
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
0ba937f
dualstack overlay cni PR
paulyufan d056ddf
rebase current branch
paulyufan adc5cab
fix conflicts
paulyufan 4111b40
fix conflicts
paulyufan be7c1f0
fix few comments
paulyufan e3ee07e
fix comments
paulyufan 369ac15
add Jaeryn's changes
paulyufan 9fa2976
add Jaeryn's changes
paulyufan a21cbe8
fix ipv4Result.IPs nil issue
paulyufan 956c653
add RequestIPs fix from Ryan
paulyufan d1b8bea
fix UT
paulyufan b1ff0ab
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan 230d6b9
fix != issue
paulyufan 64fcc5b
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan c2ac5ff
fix linter issue
paulyufan 4570853
fix comments
paulyufan 4172aac
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan 6e56bd5
fix comments
paulyufan 0cc0734
fix comments
paulyufan 7030e8f
fix linter issues
paulyufan 6d67c86
fix comments
paulyufan f435015
add Linux dropgz support
paulyufan f5f30ec
fix TM's comments
paulyufan fbc30c5
fix addNewNetRules()
paulyufan 27f8b94
fix Delete() signature
paulyufan 25adfeb
add UTs
paulyufan 4d94202
add UTs
paulyufan c262ca9
fix releaseIP UT
paulyufan 3e9be15
fix a variable name
paulyufan ef50b00
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan 1a26c3d
fix minor issues
paulyufan 7c55a6d
fix linter issue
paulyufan 4d3a50e
fix conflicts
paulyufan ea7a2d4
add proper logs
paulyufan e2a87f1
remove nolint
paulyufan f57754b
fix a bug to add netsh rule only it's dualStackOverlay mode and hnsne…
paulyufan ac74b16
comment fix part1
paulyufan2 2d9af9a
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan2 64babe3
reorg constructNetworkInfo
paulyufan2 157386c
fix comments
paulyufan2 095f786
add UTs
paulyufan2 cbc382d
fix conflicts
paulyufan2 275b8c6
fix linter issue
paulyufan2 4ad60ee
fix linter issue
paulyufan2 ed152f1
fix UT
paulyufan2 ebaf20e
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan2 0e9828a
fix comments
paulyufan2 e6a579f
comments fix
paulyufan2 159a0da
fix comments
paulyufan2 a81a42a
add fixes for comments
paulyufan2 1290ef2
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan2 cb0c309
fix UT
paulyufan2 f4a9058
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan2 3bb1d93
fix a bug
paulyufan2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "cniVersion":"0.3.0", | ||
| "name":"azure", | ||
| "plugins":[ | ||
| { | ||
| "type":"azure-vnet", | ||
| "mode":"transparent", | ||
| "ipsToRouteViaHost":["169.254.20.10"], | ||
| "ipam":{ | ||
| "type":"azure-cns", | ||
| "mode":"dualStackOverlay" | ||
| } | ||
| }, | ||
| { | ||
| "type":"portmap", | ||
| "capabilities":{ | ||
| "portMappings":true | ||
| }, | ||
| "snat":true | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| { | ||
| "cniVersion": "0.3.0", | ||
| "name": "azure", | ||
| "adapterName" : "", | ||
| "plugins": [ | ||
| { | ||
| "type": "azure-vnet", | ||
| "mode": "bridge", | ||
| "bridge": "azure0", | ||
| "capabilities": { | ||
| "portMappings": true, | ||
| "dns": true | ||
| }, | ||
| "ipam": { | ||
| "type": "azure-cns", | ||
| "mode": "dualStackOverlay" | ||
| }, | ||
| "dns": { | ||
| "Nameservers": [ | ||
| "10.0.0.10", | ||
| "168.63.129.16" | ||
| ], | ||
| "Search": [ | ||
| "svc.cluster.local" | ||
| ] | ||
| }, | ||
| "AdditionalArgs": [ | ||
| { | ||
| "Name": "EndpointPolicy", | ||
| "Value": { | ||
| "Type": "OutBoundNAT", | ||
| "ExceptionList": [ | ||
| "10.240.0.0/16", | ||
| "10.0.0.0/8" | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "Name": "EndpointPolicy", | ||
| "Value": { | ||
| "Type": "ROUTE", | ||
| "DestinationPrefix": "10.0.0.0/8", | ||
| "NeedEncap": true | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,11 @@ import ( | |
| cniTypesCurr "github.com/containernetworking/cni/pkg/types/100" | ||
| ) | ||
|
|
||
| const ( | ||
| bytesSize4 = 4 | ||
| bytesSize16 = 16 | ||
| ) | ||
|
|
||
| type AzureIPAMInvoker struct { | ||
| plugin delegatePlugin | ||
| nwInfo *network.NetworkInfo | ||
|
|
@@ -122,7 +127,7 @@ func (invoker *AzureIPAMInvoker) deleteIpamState() { | |
| } | ||
| } | ||
|
|
||
| func (invoker *AzureIPAMInvoker) Delete(address *net.IPNet, nwCfg *cni.NetworkConfig, _ *cniSkel.CmdArgs, options map[string]interface{}) error { | ||
| func (invoker *AzureIPAMInvoker) Delete(address *net.IPNet, nwCfg *cni.NetworkConfig, _ *cniSkel.CmdArgs, options map[string]interface{}) error { //nolint | ||
| if nwCfg == nil { | ||
| return invoker.plugin.Errorf("nil nwCfg passed to CNI ADD, stack: %+v", string(debug.Stack())) | ||
| } | ||
|
|
@@ -135,25 +140,28 @@ func (invoker *AzureIPAMInvoker) Delete(address *net.IPNet, nwCfg *cni.NetworkCo | |
| if err := invoker.plugin.DelegateDel(nwCfg.IPAM.Type, nwCfg); err != nil { | ||
| return invoker.plugin.Errorf("Attempted to release address with error: %v", err) | ||
| } | ||
| } else if len(address.IP.To4()) == 4 { | ||
| } else if len(address.IP.To4()) == bytesSize4 { //nolint:gocritic | ||
| nwCfg.IPAM.Address = address.IP.String() | ||
| log.Printf("Releasing ipv4 address :%s pool: %s", | ||
| nwCfg.IPAM.Address, nwCfg.IPAM.Subnet) | ||
| log.Printf("Releasing ipv4 address :%s pool: %s", nwCfg.IPAM.Address, nwCfg.IPAM.Subnet) | ||
| if err := invoker.plugin.DelegateDel(nwCfg.IPAM.Type, nwCfg); err != nil { | ||
| log.Printf("Failed to release ipv4 address: %v", err) | ||
| return invoker.plugin.Errorf("Failed to release ipv4 address: %v", err) | ||
| return invoker.plugin.Errorf("Failed to release ipv4 address: %v with error: ", nwCfg.IPAM.Address, err) | ||
| } | ||
| } else if len(address.IP.To16()) == 16 { | ||
| } else if len(address.IP.To16()) == bytesSize16 { | ||
| nwCfgIpv6 := *nwCfg | ||
| nwCfgIpv6.IPAM.Environment = common.OptEnvironmentIPv6NodeIpam | ||
| nwCfgIpv6.IPAM.Type = ipamV6 | ||
| nwCfgIpv6.IPAM.Address = address.IP.String() | ||
| if len(invoker.nwInfo.Subnets) > 1 { | ||
| nwCfgIpv6.IPAM.Subnet = invoker.nwInfo.Subnets[1].Prefix.String() | ||
| for _, subnet := range invoker.nwInfo.Subnets { | ||
| if subnet.Prefix.IP.To4() == nil { | ||
| nwCfgIpv6.IPAM.Subnet = subnet.Prefix.String() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. break from for loop after finding ipv6 subnet? |
||
| break | ||
| } | ||
| } | ||
| } | ||
|
|
||
| log.Printf("Releasing ipv6 address :%s pool: %s", | ||
| nwCfgIpv6.IPAM.Address, nwCfgIpv6.IPAM.Subnet) | ||
| log.Printf("Releasing ipv6 address :%s pool: %s", nwCfgIpv6.IPAM.Address, nwCfgIpv6.IPAM.Subnet) | ||
| if err := invoker.plugin.DelegateDel(nwCfgIpv6.IPAM.Type, &nwCfgIpv6); err != nil { | ||
| log.Printf("Failed to release ipv6 address: %v", err) | ||
| return invoker.plugin.Errorf("Failed to release ipv6 address: %v", err) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.