Skip to content

Commit d1477c8

Browse files
mugeshspMugesh SP
authored andcommitted
feat: Add conditional check for NIC type (FrontendNic) in DeleteState method to enhance endpoint deletion logic
1 parent e1522cc commit d1477c8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

network/manager.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,11 +772,13 @@ func (nm *networkManager) DeleteState(epInfos []*EndpointInfo) error {
772772

773773
if nm.IsStatelessCNIMode() {
774774
for _, epInfo := range epInfos {
775-
response, err := nm.CnsClient.DeleteEndpointState(context.TODO(), epInfo.ContainerID)
776-
if err != nil {
777-
return errors.Wrapf(err, "Delete endpoint API returned with error for endpoint %s", epInfo.ContainerID)
775+
if epInfo.NICType == cns.NodeNetworkInterfaceFrontendNIC {
776+
response, err := nm.CnsClient.DeleteEndpointState(context.TODO(), epInfo.ContainerID)
777+
if err != nil {
778+
return errors.Wrapf(err, "Delete endpoint API returned with error for endpoint %s", epInfo.ContainerID)
779+
}
780+
logger.Info("Delete endpoint API returned", zap.String("endpointID", epInfo.ContainerID), zap.String("returnCode", response.ReturnCode.String()))
778781
}
779-
logger.Info("Delete endpoint API returned", zap.String("endpointID", epInfo.ContainerID), zap.String("returnCode", response.ReturnCode.String()))
780782
}
781783
return nil
782784
}

0 commit comments

Comments
 (0)