Skip to content

Commit 0bc72e4

Browse files
authored
Moving v4overlay and dualstackoverlay to just 'overlay' in CNI (#2008)
1 parent 1514d95 commit 0bc72e4

8 files changed

+21
-10
lines changed

cni/azure-linux-swift-overlay-dualstack.conflist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ipsToRouteViaHost":["169.254.20.10"],
99
"ipam":{
1010
"type":"azure-cns",
11-
"mode":"dualStackOverlay"
11+
"mode":"overlay"
1212
}
1313
},
1414
{

cni/azure-linux-swift-overlay.conflist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
{
66
"type":"azure-vnet",
77
"mode":"transparent",
8-
"executionMode":"v4swift",
98
"ipsToRouteViaHost":["169.254.20.10"],
109
"ipam":{
1110
"type":"azure-cns",
12-
"mode":"v4overlay"
11+
"mode":"overlay"
1312
}
1413
},
1514
{

cni/azure-windows-swift-overlay-dualstack.conflist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"ipam": {
1515
"type": "azure-cns",
16-
"mode": "dualStackOverlay"
16+
"mode": "overlay"
1717
},
1818
"dns": {
1919
"Nameservers": [

cni/azure-windows-swift-overlay.conflist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
"type": "azure-vnet",
88
"mode": "bridge",
99
"bridge": "azure0",
10-
"executionMode": "v4swift",
1110
"capabilities": {
1211
"portMappings": true,
1312
"dns": true
1413
},
1514
"ipam": {
1615
"type": "azure-cns",
17-
"mode": "v4overlay"
16+
"mode": "overlay"
1817
},
1918
"dns": {
2019
"Nameservers": [

cni/network/invoker_cns.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ func (invoker *CNSIPAMInvoker) Add(addConfig IPAMAddConfig) (IPAMAddResult, erro
135135

136136
ncgw := net.ParseIP(info.ncGatewayIPAddress)
137137
if ncgw == nil {
138-
if (invoker.ipamMode != util.V4Overlay) && (invoker.ipamMode != util.DualStackOverlay) {
138+
// TODO: Remove v4overlay and dualstackoverlay options, after 'overlay' rolls out in AKS-RP
139+
if (invoker.ipamMode != util.V4Overlay) && (invoker.ipamMode != util.DualStackOverlay) && (invoker.ipamMode != util.Overlay) {
139140
return IPAMAddResult{}, errors.Wrap(errInvalidArgs, "%w: Gateway address "+info.ncGatewayIPAddress+" from response is invalid")
140141
}
141142

@@ -199,7 +200,8 @@ func (invoker *CNSIPAMInvoker) Add(addConfig IPAMAddConfig) (IPAMAddResult, erro
199200

200201
// set subnet prefix for host vm
201202
// setHostOptions will execute if IPAM mode is not v4 overlay and not dualStackOverlay mode
202-
if (invoker.ipamMode != util.V4Overlay) && (invoker.ipamMode != util.DualStackOverlay) {
203+
// TODO: Remove v4overlay and dualstackoverlay options, after 'overlay' rolls out in AKS-RP
204+
if (invoker.ipamMode != util.V4Overlay) && (invoker.ipamMode != util.DualStackOverlay) && (invoker.ipamMode != util.Overlay) {
203205
if err := setHostOptions(ncIPNet, addConfig.options, &info); err != nil {
204206
return IPAMAddResult{}, err
205207
}

cni/network/invoker_cns_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestCNSIPAMInvoker_Add_Overlay(t *testing.T) {
7777
fields: fields{
7878
podName: testPodInfo.PodName,
7979
podNamespace: testPodInfo.PodNamespace,
80-
ipamMode: util.V4Overlay,
80+
ipamMode: util.Overlay,
8181
cnsClient: &MockCNSClient{
8282
unsupportedAPIs: unsupportedAPIs,
8383
require: require,
@@ -148,6 +148,7 @@ func TestCNSIPAMInvoker_Add_Overlay(t *testing.T) {
148148
fields: fields{
149149
podName: testPodInfo.PodName,
150150
podNamespace: testPodInfo.PodNamespace,
151+
ipamMode: util.Overlay,
151152
cnsClient: &MockCNSClient{
152153
require: require,
153154
requestIPs: requestIPsHandler{

cni/network/network_windows.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ func determineWinVer() {
409409
}
410410

411411
func getNATInfo(nwCfg *cni.NetworkConfig, ncPrimaryIPIface interface{}, enableSnatForDNS bool) (natInfo []policy.NATInfo) {
412-
if nwCfg.ExecutionMode == string(util.V4Swift) && nwCfg.IPAM.Mode != string(util.V4Overlay) && nwCfg.IPAM.Mode != string(util.DualStackOverlay) {
412+
// TODO: Remove v4overlay and dualstackoverlay options, after 'overlay' rolls out in AKS-RP
413+
if nwCfg.ExecutionMode == string(util.V4Swift) && nwCfg.IPAM.Mode != string(util.V4Overlay) && nwCfg.IPAM.Mode != string(util.DualStackOverlay) && nwCfg.IPAM.Mode != string(util.Overlay) {
413414
ncPrimaryIP := ""
414415
if ncPrimaryIPIface != nil {
415416
ncPrimaryIP = ncPrimaryIPIface.(string)

cni/util/const.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,13 @@ type IpamMode string
1515
const (
1616
V4Overlay IpamMode = "v4overlay"
1717
DualStackOverlay IpamMode = "dualStackOverlay"
18+
Overlay IpamMode = "overlay" // Nothing changes between 'v4overlay' and 'dualStackOverlay' mode, so consolidating to one
1819
)
20+
21+
// Overlay consolidation plan
22+
// First, we have v4overlay and dualstackoverlay conflists both have just 'overlay' in them
23+
// Next, we release this CNI and conflist in AKS
24+
// Next we will add a third 'overlay' conflist generator in CNS
25+
// Release this CNS image
26+
// Change AKS RP to use 'overlay' option for CNS configmap, for both v4overlay and dualstackoverlay
27+
// Remove 'v4overlay' and 'dualstackoverlay' from ACN completely

0 commit comments

Comments
 (0)