The iRule just does the translation. It fires AFTER GTM has done the hard work to determine which of the GTM pool members are available. The event is DNS_RESPONSE so the iRule grabs the IP's in the response and translates those. There's no selection at this point to be done.
The GTM determines what's available from the monitors used on the GTM servers. Most of my GTM pool members are LTM VS's. So the feed of information for them comes in via the big3d - gtmd protocol.
The data groups are a simple address DG, where the key is the internal IP and the value is the 'external' ip.
H