Skip to content

Commit

Permalink
Rearrange ENI Pod deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
SaranBalaji90 authored and jayanthvn committed Dec 9, 2020
1 parent 84542f5 commit 7b36358
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/ipamd/rpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,14 @@ func (s *server) DelNetwork(ctx context.Context, in *rpc.DelNetworkRequest) (*rp
return nil, err
}

if s.ipamContext.enablePodENI {
ipamKey := datastore.IPAMKey{
ContainerID: in.ContainerID,
IfName: in.IfName,
NetworkName: in.NetworkName,
}
ip, deviceNumber, err := s.ipamContext.dataStore.UnassignPodIPv4Address(ipamKey)

if err == datastore.ErrUnknownPod && s.ipamContext.enablePodENI {
pod, err := s.ipamContext.GetPod(in.K8S_POD_NAME, in.K8S_POD_NAMESPACE)
if err != nil {
if k8serror.IsNotFound(err) {
Expand All @@ -213,12 +220,6 @@ func (s *server) DelNetwork(ctx context.Context, in *rpc.DelNetworkRequest) (*rp
}
}
}
ipamKey := datastore.IPAMKey{
ContainerID: in.ContainerID,
IfName: in.IfName,
NetworkName: in.NetworkName,
}
ip, deviceNumber, err := s.ipamContext.dataStore.UnassignPodIPv4Address(ipamKey)

log.Infof("Send DelNetworkReply: IPv4Addr %s, DeviceNumber: %d, err: %v", ip, deviceNumber, err)

Expand Down

0 comments on commit 7b36358

Please sign in to comment.