Skip to content

Commit

Permalink
fix: cni should not invoke cns to release ips for muiltitenancy (#2357)
Browse files Browse the repository at this point in the history
cni should not invoke cns to release ips for muiltitenancy
  • Loading branch information
ZetaoZhuang authored Nov 8, 2023
1 parent 6806d9a commit 3e5526e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cni/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,10 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {

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

Expand Down

0 comments on commit 3e5526e

Please sign in to comment.