Skip to content

Commit b5bf75a

Browse files
committed
add config for disabling async delete
Signed-off-by: Tamilmani <tamanoha@microsoft.com>
1 parent f052db3 commit b5bf75a

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

cni/netconfig.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ type NetworkConfig struct {
7272
EnableExactMatchForPodName bool `json:"enableExactMatchForPodName,omitempty"`
7373
DisableHairpinOnHostInterface bool `json:"disableHairpinOnHostInterface,omitempty"`
7474
DisableIPTableLock bool `json:"disableIPTableLock,omitempty"`
75+
DisableAsyncDelete bool `json:"disableAsyncDelete,omitempty"`
7576
CNSUrl string `json:"cnsurl,omitempty"`
7677
ExecutionMode string `json:"executionMode,omitempty"`
7778
IPAM IPAM `json:"ipam,omitempty"`

cni/network/network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
10791079
epInfos, err = plugin.nm.GetEndpointState(networkID, args.ContainerID)
10801080
// if stateless CNI fail to get the endpoint from CNS for any reason other than Endpoint Not found
10811081
if err != nil {
1082-
if errors.Is(err, network.ErrConnectionFailure) {
1082+
if errors.Is(err, network.ErrConnectionFailure) && !nwCfg.DisableAsyncDelete {
10831083
logger.Info("failed to connect to CNS", zap.String("containerID", args.ContainerID), zap.Error(err))
10841084
addErr := fsnotify.AddFile(args.ContainerID, args.ContainerID, watcherPath)
10851085
logger.Info("add containerid file for Asynch delete", zap.String("containerID", args.ContainerID), zap.Error(addErr))

network/manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@ func (nm *networkManager) DeleteState(epInfos []*EndpointInfo) error {
773773

774774
if nm.IsStatelessCNIMode() {
775775
for _, epInfo := range epInfos {
776+
// this cleanup happens only for standalone swiftv2 to delete endpoint state from CNS.
776777
if epInfo.NICType == cns.NodeNetworkInterfaceFrontendNIC || epInfo.NICType == cns.NodeNetworkInterfaceAccelnetFrontendNIC {
777778
response, err := nm.CnsClient.DeleteEndpointState(context.TODO(), epInfo.EndpointID)
778779
if err != nil {

0 commit comments

Comments
 (0)