Skip to content

Commit 3e5526e

Browse files
authored
fix: cni should not invoke cns to release ips for muiltitenancy (#2357)
cni should not invoke cns to release ips for muiltitenancy
1 parent 6806d9a commit 3e5526e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cni/network/network.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,10 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
535535

536536
defer func() { //nolint:gocritic
537537
if err != nil {
538-
plugin.cleanupAllocationOnError(ipamAddResult.defaultInterfaceInfo.ipResult, nwCfg, args, options)
538+
// for multi-tenancies scenario, CNI is not supposed to invoke CNS for cleaning Ips
539+
if !(nwCfg.MultiTenancy && nwCfg.IPAM.Type == network.AzureCNS) {
540+
plugin.cleanupAllocationOnError(ipamAddResult.defaultInterfaceInfo.ipResult, nwCfg, args, options)
541+
}
539542
}
540543
}()
541544

0 commit comments

Comments
 (0)