Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
0ba937f
dualstack overlay cni PR
paulyufan Mar 21, 2023
d056ddf
rebase current branch
paulyufan Mar 21, 2023
adc5cab
fix conflicts
paulyufan Mar 21, 2023
4111b40
fix conflicts
paulyufan Mar 21, 2023
be7c1f0
fix few comments
paulyufan Mar 22, 2023
e3ee07e
fix comments
paulyufan Mar 22, 2023
369ac15
add Jaeryn's changes
paulyufan Mar 23, 2023
9fa2976
add Jaeryn's changes
paulyufan Mar 23, 2023
a21cbe8
fix ipv4Result.IPs nil issue
paulyufan Mar 24, 2023
956c653
add RequestIPs fix from Ryan
paulyufan Mar 29, 2023
d1b8bea
fix UT
paulyufan Mar 30, 2023
b1ff0ab
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan Apr 4, 2023
230d6b9
fix != issue
paulyufan Apr 4, 2023
64fcc5b
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan Apr 4, 2023
c2ac5ff
fix linter issue
paulyufan Apr 4, 2023
4570853
fix comments
paulyufan Apr 5, 2023
4172aac
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan Apr 5, 2023
6e56bd5
fix comments
paulyufan Apr 5, 2023
0cc0734
fix comments
paulyufan Apr 5, 2023
7030e8f
fix linter issues
paulyufan Apr 5, 2023
6d67c86
fix comments
paulyufan Apr 7, 2023
f435015
add Linux dropgz support
paulyufan Apr 8, 2023
f5f30ec
fix TM's comments
paulyufan Apr 11, 2023
fbc30c5
fix addNewNetRules()
paulyufan Apr 12, 2023
27f8b94
fix Delete() signature
paulyufan Apr 12, 2023
25adfeb
add UTs
paulyufan Apr 13, 2023
4d94202
add UTs
paulyufan Apr 13, 2023
c262ca9
fix releaseIP UT
paulyufan Apr 13, 2023
3e9be15
fix a variable name
paulyufan Apr 13, 2023
ef50b00
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan Apr 13, 2023
1a26c3d
fix minor issues
paulyufan Apr 14, 2023
7c55a6d
fix linter issue
paulyufan Apr 14, 2023
4d3a50e
fix conflicts
paulyufan Apr 15, 2023
ea7a2d4
add proper logs
paulyufan Apr 15, 2023
e2a87f1
remove nolint
paulyufan Apr 17, 2023
f57754b
fix a bug to add netsh rule only it's dualStackOverlay mode and hnsne…
paulyufan Apr 17, 2023
ac74b16
comment fix part1
paulyufan2 Apr 18, 2023
2d9af9a
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan2 Apr 18, 2023
64babe3
reorg constructNetworkInfo
paulyufan2 Apr 18, 2023
157386c
fix comments
paulyufan2 Apr 18, 2023
095f786
add UTs
paulyufan2 Apr 18, 2023
cbc382d
fix conflicts
paulyufan2 Apr 18, 2023
275b8c6
fix linter issue
paulyufan2 Apr 19, 2023
4ad60ee
fix linter issue
paulyufan2 Apr 19, 2023
ed152f1
fix UT
paulyufan2 Apr 19, 2023
ebaf20e
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan2 Apr 19, 2023
0e9828a
fix comments
paulyufan2 Apr 20, 2023
e6a579f
comments fix
paulyufan2 Apr 20, 2023
159a0da
fix comments
paulyufan2 Apr 20, 2023
a81a42a
add fixes for comments
paulyufan2 Apr 21, 2023
1290ef2
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan2 Apr 21, 2023
cb0c309
fix UT
paulyufan2 Apr 21, 2023
f4a9058
Merge branch 'master' of https://github.com/Azure/azure-container-net…
paulyufan2 Apr 21, 2023
3bb1d93
fix a bug
paulyufan2 Apr 21, 2023
f720634
fix issue
paulyufan Apr 21, 2023
cc72429
remove space line
paulyufan2 Apr 21, 2023
b1667d3
fix comments
paulyufan2 Apr 24, 2023
e832115
fix comments
paulyufan2 Apr 24, 2023
e995771
add gateway check
paulyufan2 Apr 24, 2023
dbd1f90
uncheck ipv6Mode
paulyufan2 Apr 25, 2023
328d145
fix addNewNetRules() UT
paulyufan2 Apr 25, 2023
7fb24fc
fix addNewNetRules() UT
paulyufan2 Apr 25, 2023
018398b
fix addNewNetRules() UT
paulyufan2 Apr 25, 2023
3e9c022
fix linter issue
paulyufan2 Apr 26, 2023
d46b740
Merge branch 'master' into dualstack-overlay-cni
paulyufan2 Apr 26, 2023
95d1f3f
remove empty line
paulyufan2 Apr 27, 2023
ad1f38a
disable copying azure-vnet binary
paulyufan2 Apr 27, 2023
651a06c
add copying azure-vnet binary
paulyufan2 Apr 27, 2023
20973de
add copying azure-vnet binary
paulyufan2 Apr 27, 2023
d9b80f3
commit for running new pipeline
paulyufan2 Apr 27, 2023
842caf0
rerun pipeline
Apr 28, 2023
67e161e
rerun pipeline
Apr 28, 2023
c6fd671
rerun pipeline
Apr 28, 2023
1ea832d
fix azureSubscription
paulyufan2 Apr 28, 2023
70a94a8
trigger pipeline rerun
Apr 28, 2023
8a08741
rerun pipeline
paulyufan2 Apr 29, 2023
f03c963
rerun pipeline
paulyufan2 Apr 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ steps:

- task: AzureCLI@2
inputs:
azureSubscription: "Azure Container Networking - Test"
azureSubscription: $(AZURE_TEST_AGENT_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ steps:

- task: AzureCLI@2
inputs:
azureSubscription: "Azure Container Networking - Test"
azureSubscription: $(AZURE_TEST_AGENT_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ steps:

- task: AzureCLI@2
inputs:
azureSubscription: "Azure Container Networking - Test"
azureSubscription: $(AZURE_TEST_AGENT_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ CNI_MULTITENANCY_TRANSPARENT_VLAN_BUILD_DIR = $(BUILD_DIR)/cni-multitenancy-tran
CNI_SWIFT_BUILD_DIR = $(BUILD_DIR)/cni-swift
CNI_OVERLAY_BUILD_DIR = $(BUILD_DIR)/cni-overlay
CNI_BAREMETAL_BUILD_DIR = $(BUILD_DIR)/cni-baremetal
CNI_DUALSTACK_BUILD_DIR = $(BUILD_DIR)/cni-dualstack
CNS_BUILD_DIR = $(BUILD_DIR)/cns
NPM_BUILD_DIR = $(BUILD_DIR)/npm
TOOLS_DIR = $(REPO_ROOT)/build/tools
Expand Down Expand Up @@ -94,6 +95,7 @@ CNI_MULTITENANCY_TRANSPARENT_VLAN_ARCHIVE_NAME = azure-vnet-cni-multitenancy-tra
CNI_SWIFT_ARCHIVE_NAME = azure-vnet-cni-swift-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
CNI_OVERLAY_ARCHIVE_NAME = azure-vnet-cni-overlay-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
CNI_BAREMETAL_ARCHIVE_NAME = azure-vnet-cni-baremetal-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
CNI_DUALSTACK_ARCHIVE_NAME = azure-vnet-cni-overlay-dualstack-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
CNM_ARCHIVE_NAME = azure-vnet-cnm-$(GOOS)-$(GOARCH)-$(ACN_VERSION).$(ARCHIVE_EXT)
CNS_ARCHIVE_NAME = azure-cns-$(GOOS)-$(GOARCH)-$(CNS_VERSION).$(ARCHIVE_EXT)
NPM_ARCHIVE_NAME = azure-npm-$(GOOS)-$(GOARCH)-$(NPM_VERSION).$(ARCHIVE_EXT)
Expand Down Expand Up @@ -624,6 +626,12 @@ endif
cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-ipam$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) $(CNI_OVERLAY_BUILD_DIR)
cd $(CNI_OVERLAY_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_OVERLAY_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-ipam$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config

$(MKDIR) $(CNI_DUALSTACK_BUILD_DIR)
cp cni/azure-$(GOOS)-swift-overlay-dualstack.conflist $(CNI_DUALSTACK_BUILD_DIR)/10-azure.conflist
cp telemetry/azure-vnet-telemetry.config $(CNI_DUALSTACK_BUILD_DIR)/azure-vnet-telemetry.config
cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) $(CNI_DUALSTACK_BUILD_DIR)
cd $(CNI_DUALSTACK_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_DUALSTACK_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config

#baremetal mode is windows only (at least for now)
ifeq ($(GOOS),windows)
$(MKDIR) $(CNI_BAREMETAL_BUILD_DIR)
Expand Down
22 changes: 22 additions & 0 deletions cni/azure-linux-swift-overlay-dualstack.conflist
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
}
]
}
49 changes: 49 additions & 0 deletions cni/azure-windows-swift-overlay-dualstack.conflist
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
}
}
]
}
]
}
2 changes: 2 additions & 0 deletions cni/network/cnsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
type cnsclient interface {
RequestIPAddress(ctx context.Context, ipconfig cns.IPConfigRequest) (*cns.IPConfigResponse, error)
ReleaseIPAddress(ctx context.Context, ipconfig cns.IPConfigRequest) error
RequestIPs(ctx context.Context, ipconfig cns.IPConfigsRequest) (*cns.IPConfigsResponse, error)
ReleaseIPs(ctx context.Context, ipconfig cns.IPConfigsRequest) error
GetNetworkContainer(ctx context.Context, orchestratorContext []byte) (*cns.GetNetworkContainerResponse, error)
GetAllNetworkContainers(ctx context.Context, orchestratorContext []byte) ([]cns.GetNetworkContainerResponse, error)
}
26 changes: 17 additions & 9 deletions cni/network/invoker_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()))
}
Expand All @@ -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()
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)
Expand Down
Loading