Skip to content

Commit

Permalink
Return delete success for pods that never got scheduled
Browse files Browse the repository at this point in the history
(cherry picked from commit b0b2fc1)
  • Loading branch information
Claes Mogren authored and mogren committed Sep 30, 2019
1 parent ce02bed commit 234ba0c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ipamd/rpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ func (s *server) DelNetwork(ctx context.Context, in *pb.DelNetworkRequest) (*pb.
}
log.Infof("Send DelNetworkReply: IPv4Addr %s, DeviceNumber: %d, err: %v", ip, deviceNumber, err)

return &pb.DelNetworkReply{Success: err == nil, IPv4Addr: ip, DeviceNumber: int32(deviceNumber)}, nil
// Plugins should generally complete a DEL action without error even if some resources are missing. For example,
// an IPAM plugin should generally release an IP allocation and return success even if the container network
// namespace no longer exists, unless that network namespace is critical for IPAM management
success := true
if err != nil && err != datastore.ErrUnknownPod {
success = false
}
return &pb.DelNetworkReply{Success: success, IPv4Addr: ip, DeviceNumber: int32(deviceNumber)}, nil
}

// RunRPCHandler handles request from gRPC
Expand Down

0 comments on commit 234ba0c

Please sign in to comment.